The tree is not synchronized with the store. It just uses it to build the 
nodes. Changes in the LayerStore don’t automatically reflect in the tree. So if 
you look at your code, you can see that it is trying to build a tree from an 
empty store.
The layerTree code needs to execute AFTER the store has loaded.

Matt Priour
Kestrel Computer Consulting

From: Denis Rykov 
Sent: Thursday, August 11, 2011 11:44 PM
To: Users@geoext.org 
Subject: [Users] Layer tree based on WFSCapabilitiesStore

Is it possible to build layer tree based on WFSCapabilitiesStore?

I try to make it as following:

        <script>
        var store, layerList;
            Ext.onReady(function() {

                Ext.onReady(function() {

                    // create a new WFS capabilities store
                    store = new GeoExt.data.WFSCapabilitiesStore({
                        url:
"http://map.rostmuseum.ru/scripts/tinyows/tinyows.cgi?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetCapabilities";,
                        layerOptions: function() {
                            return {
                                visibility: false,
                                displayInLayerSwitcher: false,
                                strategies: [new
OpenLayers.Strategy.BBOX({ratio: 1})]
                            };
                        }
                    });

                    layerList = new GeoExt.tree.LayerContainer({
                        text: 'All Layers',
                        layerStore: store,
                        leaf: false,
                        expanded: true
                    });

                    var layerTree = new Ext.tree.TreePanel({
                        title: 'Map Layers',
                        renderTo: 'capgrid',
                        root: layerList
                    });

                    store.load();
                });
            });
        </script>

But it not works.
_______________________________________________
Users mailing list
Users@geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
Users@geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users

Reply via email to