I am using OpenLayers 2.12 for this WFS filter purpose. I wanted to redraw filter layer as conditions in filter changes dynamic.
Following is my code in for WFS:
var ty=OpenLayers.Filter.Comparison.EQUAL_TO;
var propertyOP="name";
var valOP="buil2";
build1 = new OpenLayers.Layer.Vector("WFS", {
strategies: [new OpenLayers.Strategy.BBOX()],
filter: new OpenLayers.Filter.Comparison({
type: ty,
property: propertyOP,
value: ValOP
}),
protocol: new OpenLayers.Protocol.WFS({
srsName:"EPSG:4326",
version: "1.1.0",
url: "http://localhost:8080/geoserver/sol/wfs",
featureType: "ch",
featurePrefix:"sol",
featureNS: "http://localhost:81/sol"/*,
geometryName:"geom"*/
}),
projection: geographic,
styleMap: styleMap
});
map.addLayer(build1);
Now I wanted to make this filter to update and show new filter layer result. In my current code previous filter result remain but show result on previous result. My Filter type,property and value get changed.
Answer
I have solved this question and worked in my case:
build1.filter = new OpenLayers.Filter.Comparison({
type: ty,
property: propertyOP,
value: ValOP
});
build1.refresh({force:true});
No comments:
Post a Comment