[Users] Filter a Feature

Mario mario.schedler at web.de
Sat Apr 24 17:57:46 CEST 2010


Hi List,

I have played a little bit with GeoExt and figured out that you can remove
Records from the Store to remove the Features from the map.

 

store = new GeoExt.data.FeatureStore({

        layer: vecLayer,

        fields: [

            {name: 'name', type: 'string'},

            {name: 'id', type: 'string'}

        ],

        proxy: new GeoExt.data.ProtocolProxy({

            protocol: new OpenLayers.Protocol.HTTP({

                url: "point.asp",  // this is due to IIS

                format: new OpenLayers.Format.GML()

            })

        }),

                autoLoad: true

    });

 

 

Now I'm creating a new Layer, applying a filter to the old Store and
creating a new Store

tmpLayer = new OpenLayers.Layer.Vector("Vector 2");

 

store.filter('id', 'value', true, true);

tmpStore = new GeoExt.data.FeatureStore({

       layer: tmpLayer


});

 

 

To remove some Records from the Store

 

for (i = 0; i < store.getCount(); i++) {

      var record = store.getAt(i);

      tmpStore.add(record);

}

 

Does anybody has a better solution. It's working but I have some trouble
with the eventListeners when selecting Features.

 

Best regards,

Mario

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20100424/b27f4b3e/attachment.htm 


More information about the Users mailing list