[Users] gx_layercontainer filter:
Andreas Hocevar
ahocevar at opengeo.org
Thu Jan 28 18:21:45 CET 2010
Hey-
your code should work with a current trunk version of GeoExt, but not
with GeoExt 0.6. Which version are you using?
Regards,
Andreas.
Brian Marble wrote:
> Hey,
>
> I am trying to filter a gx_layercontainer (see below). No matter what I do
> all of my map.layers show in this branch of the tree. I want to have more
> control over the contents of all branches of the tree. It looks like the
> filter function just needs to be overridden on my part but I am unable to
> make it work as below.
>
> My test code below is taken from
> http://dev.geoext.org/trunk/geoext/examples/tree.html
>
> Can anyone point out my oversights?
>
> Thanks,
> Brian
>
> ar options = {
> projection: new OpenLayers.Projection("EPSG:900913"),
> displayProjection: new OpenLayers.Projection("EPSG:4326"),
> theme: null,
> units: "m",
> maxResolution: 156543.0339,
> maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34,
> 20037508.34, 20037508.34)
> // allOverlays: true
> };
>
> map = new OpenLayers.Map('mapContainer', options);
>
> var treeConfig = new OpenLayers.Format.JSON().write([{
> nodeType: "gx_baselayercontainer",
> text: "Base Layers"
> }, {
> nodeType: "gx_overlaylayercontainer",
> text: "Over Layers",
> expanded: false,
> loader: {
> }
> }, {
> nodeType: "gx_layercontainer",
> text: "Special Layers",
> expanded: false,
> loader: {
> filter: function(record) {
> var layer = record.get("layer");
> // return (!layer.isBaseLayer && layer.name == "2000
> Census - Population (TC)");
> return !layer.isBaseLayer;
> }
>
> }
> }
> ], true);
>
> var tree = new Ext.tree.TreePanel({
> border: true,
> region: "west",
> title: "Layers",
> width: 200,
> split: true,
> collapsible: true,
> collapseMode: "mini",
> autoScroll: true,
> loader: new Ext.tree.TreeLoader({
> applyLoader: false
> }),
>
> root: {
> nodeType: "async",
> children: Ext.decode(treeConfig)
> },
> listeners: {
> "insert": registerRadio,
> "append": registerRadio
> },
> rootVisible: false,
> lines: false,
> bbar: [{
> text: "Show/Edit Tree Config",
> handler: function() {
> treeConfigWin.show();
> Ext.getCmp("treeconfig").setValue(treeConfig);
> }
> }]
> });
>
> ______________________________________________
> Brian Marble
> LandEZ Corp.
> W - 435 787 9003
> C - 435 881 3117
> F - 435 787 9004
> BrianMarble at LandEZ.com
>
>
>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
More information about the Users
mailing list