You cannot filter the store before it is loaded - add a load listener to the store, and set your filter there.
Andreas. On Aug 3, 2011, at 14:40 , Antony Scott wrote: > Andreas, > > Thanks, but still having no luck, below are relevant sections of my code in > case someone cam spot where I am going wrong... > > At the top: > > var md_store = new GeoExt.data.WMSCapabilitiesStore({ > url: > "http://localhost:8080/geoserver/ows?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities", > fields: ["name","title","abstract","keywords"], > autoLoad: true > }); > > md_store.filter("keywords","test"); > > var md_grid = new Ext.grid.GridPanel({ > collapsible: true, > split: true, initialSize: 100, > autoScroll:true, > height: 200, > width: 320, > title: "Available WMS Layers", > region: "south", > viewConfig: {forceFit: true}, > store: md_store, > columns: [ > {header: "Name", dataIndex: "name", sortable: true}, > {header: "Title", dataIndex: "title", sortable: true}, > {header: "Abstract", dataIndex: "abstract"}, > {header: "Keywords", dataIndex: "keywords"} > ] > }); > > ..................... > At the bottom: > xtype: 'panel', > defaults:{autoScroll:true}, > region: 'west', > split: true, > width: 250, > items: [ tree > , formPanel > , legendPanel > ] > } > , md_grid > ] > }); > > Currently I'm seeing all 22 of my GeoServer layers in the grid, rather than > the one which I would expect the filter to return. > > Many thanks > Antony > > -----Original Message----- > From: Andreas Hocevar [mailto:ahoce...@opengeo.org] > Sent: 03 August 2011 12:04 > To: Antony Scott > Cc: users@geoext.org > Subject: Re: [Users] Accessing Layer Metadata > > Hi, > > you have to apply the filter *before* your tree loaders access the store. The > loaders don't listen to filter changes. > > Andreas. > > On Aug 3, 2011, at 12:42 , Antony Scott wrote: > >> Andreas >> >> Many thanks - yes I tried that too, but same result, nothing I have tried >> actually applies the filter to my data. >> >> As per Rob (go Brissle..!), ideally I'd like something which was sensitive >> to the layers in the tree to avoid having to set a bespoke filter, but maybe >> that would require some extension development. >> >> Cheers >> Antony >> >> -----Original Message----- >> From: Andreas Hocevar [mailto:ahoce...@opengeo.org] >> Sent: 03 August 2011 10:24 >> To: Antony Scott >> Cc: users@geoext.org >> Subject: Re: [Users] Accessing Layer Metadata >> >> Hi, >> >> filtering a store is the same for all Ext stores. See >> http://dev.sencha.com/deploy/ext-3.4.0/docs/?class=Ext.data.Store. >> >> In your snippet, this would be >> >> store.filter("keywords", "test"); >> >> Andreas. >> >> On Aug 3, 2011, at 10:34 , Antony Scott wrote: >> >>> Good morning all >>> >>> I've been trying to find a simple way of displaying the metadata for the >>> layers I am using in a layer tree. I've managed to list all the layers in >>> an ExtJS gridPanel, but have not been able to successfully apply a filter >>> to the store - this, for example, seems to have no effect on the list, >>> which displays all my GeoServer layers: >>> store.filter([ { >>> property : 'keywords', >>> value : 'test'}]); >>> >>> Ideally in fact I would like to display - either in a grid, or in the tree >>> itself - metadata for only the layers which are shown in the tree. >>> >>> The other option I have looked at is storing the metadata in the SLD, >>> though as it relates to the layer rather than the style I would prefer not >>> to do this. >>> >>> Can anyone point me in the direction of a working example? >>> >>> Many thanks >>> >>> Antony >>> >>> Antony Scott >>> >>> >>> Sustain is a leading carbon reduction company. Our clients have saved >>> >>> 4,131,800 lifetime tCO2e through working with us (June 2011) >>> >>> >>> >>> Sustain Ltd. Registered in England No. 3384793 >>> Barley Wood Stables, Long Lane, Wrington, Bristol BS40 5SA, UK >>> >>> This e-mail and any attachments are strictly confidential and intended >>> solely for the >>> addressee. If you are not the intended recipient of this document then you >>> must >>> immediately inform the sender and delete this e-mail and any attachments >>> from >>> your system. >>> >>> E-mail transmissions cannot be guaranteed to be secure or error free as >>> information >>> could be intercepted, corrupted, lost, destroyed, arrive late or >>> incomplete. The sender >>> does not accept liability for any errors or omissions in the content of >>> this message >>> which arise as a result of e-mail transmission. >>> >>> >>> _______________________________________________ >>> Users mailing list >>> Users@geoext.org >>> http://www.geoext.org/cgi-bin/mailman/listinfo/users >> >> >> >> -- >> Andreas Hocevar >> OpenGeo - http://opengeo.org/ >> Expert service straight from the developers. >> >> >> Sustain is a leading carbon reduction company. Our clients have saved >> 4,131,800 lifetime tCO2e through working with us (June 2011) >> >> ------------------------------------------------------------ >> >> Sustain Ltd. Registered in England No. 3384793 >> Barley Wood Stables, Long Lane, Wrington, Bristol BS40 5SA, UK >> >> ------------------------------------------------------------ >> >> This e-mail and any attachments are strictly confidential >> and intended solely for the addressee. If you are not the >> intended recipient of this document then you must >> immediately inform the sender and delete this e-mail and >> any attachments from your system. >> >> E-mail transmissions cannot be guaranteed to be secure or >> error free as information could be intercepted, corrupted, >> lost, destroyed, arrive late or incomplete. The sender >> does not accept liability for any errors or omissions in >> the content of this message which arise as a result of >> e-mail transmission. >> >> ------------------------------------------------------------ >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> _______________________________________________ >> Users mailing list >> Users@geoext.org >> http://www.geoext.org/cgi-bin/mailman/listinfo/users > > -- > Andreas Hocevar > OpenGeo - http://opengeo.org/ > Expert service straight from the developers. > > > Sustain is a leading carbon reduction company. Our clients have saved > 4,131,800 lifetime tCO2e through working with us (June 2011) > > ------------------------------------------------------------ > > Sustain Ltd. Registered in England No. 3384793 > Barley Wood Stables, Long Lane, Wrington, Bristol BS40 5SA, UK > > ------------------------------------------------------------ > > This e-mail and any attachments are strictly confidential > and intended solely for the addressee. If you are not the > intended recipient of this document then you must > immediately inform the sender and delete this e-mail and > any attachments from your system. > > E-mail transmissions cannot be guaranteed to be secure or > error free as information could be intercepted, corrupted, > lost, destroyed, arrive late or incomplete. The sender > does not accept liability for any errors or omissions in > the content of this message which arise as a result of > e-mail transmission. > > ------------------------------------------------------------ > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > Users mailing list > Users@geoext.org > http://www.geoext.org/cgi-bin/mailman/listinfo/users -- Andreas Hocevar OpenGeo - http://opengeo.org/ Expert service straight from the developers. _______________________________________________ Users mailing list Users@geoext.org http://www.geoext.org/cgi-bin/mailman/listinfo/users