[Users] treePanel (more questions)

geographika geographika at gmail.com
Mon Nov 15 12:59:56 CET 2010


On 12/11/2010 10:02, Stefanie Weykam wrote:
> Now, how can I add a checkbox to the group node? The objective is to
> turn all child nodes on and off at once. Such as if this was a layer
> group (gx_layer), except that these children aren’t necessarily layers
> with a common URL. Can this somehow be achieved by modifying a layerNode
> or rather by modifying the layerContainer?
>
> I would highly appreciate your opinion.
> Best regards,
> Stefanie Weykam
>

To add a checkbox to a groupnode add a "checked" property, and then 
switch the sublayers on and off in the "checkchange" event.
{
                     "nodeType": "gx_overlaylayercontainer",
                     "expanded": false,
                     checked: false,
                     "text": "Group of Layers",
                     listeners: {
                         "checkchange": function(node, checked){
                             node.eachChild(function(n){
                                 n.getUI().toggleCheck(checked);
                             });
                         }
                     },
                     "loader": ...
                     })
}

Regards,

Seth

http://geographika.co.uk



More information about the Users mailing list