[Users] GeoExt LayerContainer with checkbox
Frans Knibbe
frans.knibbe at geodan.nl
Tue Jan 25 10:46:07 CET 2011
Thanks for sharing this technique, I was looking for something like this!
But I do see a problem for my needs: The LayerContainer node is expanded
each time its checkbox is changed. I would like the collapsing and
expanding of the node to be something entirely separate. I.e., I would
like to leave it up to the user if (s)he wants the node expanded or not.
Using the checkbox of the LayerContainer should not change its
expanded/collapsed state.
Can someone think of a solution? Just removing node.expand() stops the
whole thing from working.
On 2010-06-07 22:24, Julien-Samuel Lacroix wrote:
> Hi,
>
> I have a Tree with LayerContainers.I want to have a checkbox beside my
> directory that will allow me check/uncheck all the layers in my
> LayerContainer in a single click.
>
> Here's how I do it. Maybe there's a better way, I may have miss
> something.
>
> {
> text: title,
> layerStore: mapPanel.layers,
> allowDrag: false,
> nodeType: 'gx_layercontainer',
> id: 'layercontainer_'+group,
> leaf: false,
> group: group,
> loader: {
> filter: function(record) {
> return record.get('layer').options.group == group;
> }
> },
> checked: false,
> listeners: {
> 'checkchange' : function(node, checked)
> {
> // If a parent node is unchecked, uncheck all the children
> if (node.getUI().isChecked()) {
> node.expand();
> node.eachChild(function(child){
> child.ui.toggleCheck(true);
> });
> }
> if (!node.getUI().isChecked())
> {
> node.expand();
> node.eachChild(function(child) {
> child.ui.toggleCheck(false);
> });
> }
> }
> },
> [...snip...]
> }
>
>
More information about the Users
mailing list