Here is an example.<br><br>The WFS layer<br><br>var state = new OpenLayers.Layer.Vector("Karnataka", {<br> strategies: [new OpenLayers.Strategy.BBOX()],<br> filter:"",<br> protocol: new OpenLayers.Protocol.WFS({<br>
version: "1.1.0",<br> url: "<a href="http://Aparna:8085/geoserver/wfs">http://Aparna:8085/geoserver/wfs</a>", <br> featureType: "detail",<br>
featureNS: "<a href="http://opengeo.org/India">http://opengeo.org/India</a>" <br> })<br> <br> });<br><br>next what I have is a checkbox that is used to filter the layer<br>
I have an array that added the value of every checkbox on the click event. <br><br>var list = '';<br> $('#schcat input[type="checkbox"]:checked').each(function(){<br> list += $('#schcat').attr('id').toUpperCase() +"=" +($(this).val()) + ' OR '<br>
});<br> str =list.substring(0,list.length-3);<br> //alert(str);<br> var x= str.length;<br><br>If the length of the array is greater than zero then filter the layers<br>
<br> var newfilter=format.read(str);<br> map.layers[2].filter=newfilter;<br> map.layers[2].refresh({force:true}); <br><br><br><br><br><br><br><br><div class="gmail_quote">On Sun, Feb 19, 2012 at 9:43 PM, Shadin <span dir="ltr"><<a href="mailto:w_ward_W@hotmail.com">w_ward_W@hotmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">would you please give more details about how to do it ?<br>
where did you put the filter ?<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://osgeo-org.1560.n6.nabble.com/Filtering-a-vector-Layer-tp3911020p4485406.html" target="_blank">http://osgeo-org.1560.n6.nabble.com/Filtering-a-vector-Layer-tp3911020p4485406.html</a><br>
Sent from the OpenLayers Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>
</font></blockquote></div><br>