[Users] checkcahnge in treepanel loads data twice
bartvde at osgis.nl
bartvde at osgis.nl
Tue Nov 24 15:30:05 CET 2009
Hmm, can any of you then create a reproducable minimized test case? I
thought it was fixed because the old code used to read:
/** private: method[onCheckChange]
* :param node: ``GeoExt.tree.LayerNode``
* :param checked: ``Boolean``
*
* handler for checkchange events
*/
onCheckChange: function(node, checked) {
if (checked && this.layer.isBaseLayer && this.layer.map) {
this.layer.map.setBaseLayer(this.layer);
}
this.layer.setVisibility(checked);
},
whereas now it reads (check against layer visibility was added):
/** private: method[onCheckChange]
* :param node: ``GeoExt.tree.LayerNode``
* :param checked: ``Boolean``
*
* handler for checkchange events
*/
onCheckChange: function(node, checked) {
if(checked != this.layer.getVisibility()) {
var layer = this.layer;
if(checked && layer.isBaseLayer && layer.map) {
layer.map.setBaseLayer(layer);
} else {
layer.setVisibility(checked);
}
}
},
In our situation this fixed the issue.
TIA.
Best regards,
Bart
> I actually noticed that "checkchange" fires twice too and I'm using
> revision 1483 from Nov 20th.
>
> My workaround was simply
>
> listeners: {
> "checkchange": {
> fn: function() {
> this.attributes.checked ? doIfChecked() : doIfUnchecked();
> }
> }
> }
>
> Christian
>
> On Tue, Nov 24, 2009 at 9:06 AM, <bartvde at osgis.nl> wrote:
>> Hi,
>>
>> which version are you using? This was fixed in 0.6 IIRC.
>>
>> Best regards,
>> Bart
>>
>>> Hi,
>>>
>>> I want use the checkchange-function to reload Attributes if the Layer
>>> ist still the aktive one.
>>> I tried this and every time I checked/unchecked the checkboxes of a
>>> layer, the console
>>> writes two times in a row.
>>>
>>> var treePanel = new Ext.tree.TreePanel({
>>> Â Â Â Â Â id: 'lt',
>>> Â Â Â Â Â title: 'Layer',
>>> Â Â Â Â Â region: 'west',
>>> Â Â Â Â Â loader: new Ext.tree.TreeLoader({
>>> Â Â Â Â Â Â applyLoader: false
>>> Â Â Â Â Â }),
>>> Â Â Â Â Â root: {
>>> Â Â Â Â Â Â nodeType: "async",
>>> Â Â Â Â Â Â children: Ext.decode(treeConfig)
>>> Â Â Â Â Â },
>>> Â Â Â Â Â rootVisible: false,
>>> Â Â Â Â Â lines: true,
>>> Â Â Â Â Â enableDD: true,
>>> Â Â Â Â Â split: true,
>>> Â Â Â Â Â autoScroll:true,
>>> Â Â Â Â Â collapsible: true,
>>> Â Â Â Â Â bodyStyle: 'padding:5px;',
>>> Â Â Â Â Â width: 200,
>>> Â Â Â Â Â minSize: 200,
>>> Â Â Â Â Â listeners: {
>>> Â Â Â Â Â Â Â 'checkchange': function(node, checked){
>>> Â Â Â Â Â Â Â Â Â if(checked){
>>> Â Â Â Â Â Â Â Â Â console.log("Checked");
>>> Â Â Â Â Â Â Â }else{
>>> Â Â Â Â Â Â Â Â Â console.log("Unchecked");
>>> Â Â Â Â Â Â Â }
>>> Â Â Â Â }
>>> Â Â },
>>> });
>>>
>>> Is there a way to suppress this behavior? Cause if I have more
>>> attributes, it needs a lot of time and doesn't look good.
>>>
>>>
>>> Regards.
>>>
>>> Sascha
>>> _______________________________________________
>>> Users mailing list
>>> Users at geoext.org
>>> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at geoext.org
>> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>>
>
More information about the Users
mailing list