[Users] checkcahnge in treepanel loads data twice
Christian Spanring
christian at spanring.eu
Tue Nov 24 16:13:56 CET 2009
I modified the tree example a little and put it there:
http://maps.mapc.org/debug/checkchange.html
Open Firebug and check/uncheck the Cities layer (the event writes to
console.info).
Thanks!
Christian
On Tue, Nov 24, 2009 at 9:30 AM, <bartvde at osgis.nl> wrote:
> 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