PDA

View Full Version : Filter



ballibum
24 Aug 2009, 11:27 PM
Hello Forum, i need ur help. I am setting up a datastore of geoext, in the api of geoext is to read, that the geoext.data.featurestore uses the methods, functions and parameters of the ext.data.store. now, i need to set up a filter. But i do not find the right position to set up a filter and i can not read the ext api.... so i do not know the rigght syntax for filtering. has someone an example for me?

that is my code:

gebaeudeStore = new GeoExt.data.FeatureStore({
layer: gebaeude,
autoDestroy:true,
proxy: new GeoExt.data.ProtocolProxy({
protocol: new OpenLayers.Protocol.WFS({
url: "http://localhost/geoserver/wfs",
featureType: "test",
featureNS: "http://www.test.org/",
srsName: "EPSG:4326",
version: "1.1.0",
extractAttributes: true
})
}),
fields: [
{name: 'id', type: 'string'},
{name: 'nummer', type: 'string'}

],
autoLoad: true
});

thanks

fallenrayne
25 Aug 2009, 8:31 AM
You can't read the ExtJS API?

filter(String field, String/RegExp value, [Boolean anyMatch], [Boolean caseSensitive] ) : void
Filter the records by a specified property.

or

filterBy( Function fn, [Object scope] ) : void
Filter by a function. The specified function will be called for each Record in this Store. If the function returns true the Record is included, otherwise it is filtered out.

--------------------------------------------------------------------



store.filter("fieldToFilter","RegExp to filter with");


or



store.filterBy(function(record,id){
if(record.data.name == "test"){
return true;
}else{
return false;
}
});