[Users] featureStore filter reload

Simone Dalmasso simone.dalmasso at gmail.com
Tue Nov 2 15:23:53 CET 2010


Seems that the proxy doesn't have the setFilter method.
Actually the strategy is an excellent solution, but I need to trigger a
reload of the store on zoomend and moovend.

To explain I pos my new code:

*var sites = new OpenLayers.Layer.Vector('Sites',{*
* **styleMap: styleMap,*
* **strategies: [/*new OpenLayers.Strategy.Fixed(),*/new
OpenLayers.Strategy.BBOX()], *
* **projection: new OpenLayers.Projection("EPSG:4326"), *
* **protocol: new OpenLayers.Protocol.WFS({ *
* **version: "1.1.0", *
* **    srsName: "EPSG:4326",*
* **url: '/geoserver/wfs/',*
* **featureType: 'name',*
* **    featurePrefix: "prefix"*
* **})*
* **}); *

*map.events.register('zoomend',this, function(){*
* ** sites.redraw();*
* **});*
*
*
var featureStore = new GeoExt.data.FeatureStore({
    fields: [
        {name: "name", type: "string"}
    ],
    layer: sites
 });

and more...

With that I can't see changes in the grid.

Thanks a lot for your help.

Simone

2010/11/2 Andreas Hocevar <ahocevar at opengeo.org>

> Hi,
>
> try the following:
>
> featureStore.proxy.setFilter(your_new_filter);
> featureStore.reload();
>
> But note that you could also configure your vector layer with your protocol
> and a BBOX strategy, and bind your featureStore to that layer by configuring
> the store's layer property. This will make the BBOX strategy take care of
> requesting features for the correct extent.
>
> Regards,
> Andreas.
>
> On Nov 2, 2010, at 14:24 , Simone Dalmasso wrote:
>
> > Hi list, I have an OL vector layer with a feature store linked. The
> output of the store is in a grid, so I have the name of the features
> selectable.
> > What I would like to do is to apply a spatial filter (BBOX) on the store
> to have displayed in the grid only the features that are within the BBOX.
> The update events for the store should be the 'zoomend' and the 'moveend'
> events of the map.
> > I post some code:
> >
> > var featureStore = new GeoExt.data.FeatureStore({
> >           fields: [
> >               {name: "name", type: "string"}
> >           ],
> >           layer: map.getLayersByName('Sites')[0],
> >             featureFilter : new OpenLayers.Filter.Spatial({
> >               type : OpenLayers.Filter.Spatial.BBOX,
> >               value : map.getExtent()
> > });
> > var gridFeature = new Ext.grid.GridPanel({
> >               store: featureStore,
> >               sm: new GeoExt.grid.FeatureSelectionModel(),
> >               cm: new Ext.grid.ColumnModel([{header:'Name',dataIndex:
> "name",id:'name'}]),
> >               autoExpandColumn : 'name'
> > });
> >
> > Then I wrote:
> > map.events.register('zoomend',this, function(){
> >             featureStore.reload();
> > });
> >
> > But in this way I get the this.proxy is null error from ext.js
> > I've also tried to re-bind the layer:
> > map.events.register('zoomend',this, function(){
> >     featureStore.unbind();
> >     featureStore.bind(map.getLayersByName('Sites')[0]);
> > });
> >  But I get record is undefined error from ext.js
> >
> > For both I still have all the features displayed in the grid.
> > Maybe I should destroy and recreate the entire gridPanel but is not the
> right way to do that for me.
> > Can you help me?
> > Thanks
> > --
> > Simone Dalmasso
> > _______________________________________________
> > 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.
>
>


-- 
Simone Dalmasso, Ing.
ITHACA
Information Technology for Humanitarian Assistance, Cooperation and Action
www.ithacaweb.org
Via Pier Carlo Boggio 61 - 10138 Torino
Tel: +39.011.1975.1854
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20101102/c1c17dc2/attachment-0001.htm 


More information about the Users mailing list