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