[OpenLayers-Users] Filters doesn't work with features attributes

Jimmy Aumard jimmy.aumard at gmail.com
Wed Dec 23 03:29:56 EST 2009


Hi,

I have problems with filters. I try to create filter dynamically to select
many feature on my layer.

Some test code :

var layer=map.getLayersBy('name','franch')[0];
var filter= new OpenLayers.Filter.Comparison({
            type: OpenLayers.Filter.Comparison.LIKE,
            property: "Nom",
            value: "test"
        });
for(i=0;i<layer.features.length;i++){
    var feature=layer.features[i];
        alert(feature.attributes.Nom);
    if(filter.evaluate(feature)){
    alert('ee');
}
}

I have features with an attribute "Nom" = "test" but the filter return alway
false.

What I'm doing wrong?

Regards,

Jim

-- 
Aumard Jimmy
Développeur - http://www.kinaxia.fr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20091223/3d947a73/attachment.html


More information about the Users mailing list