When using vector layers in OpenLayers, it is always best to use the filter startegy instead of the filter parameter in the layer:
var filterStrategy = new OpenLayers.Strategy.Filter({filter: your_filter_here});
var station = new OpenLayers.Layer.Vector("station", {
strategies: [ filterStrategy ]
});
and:
$("#button1").click(function () {
var filter = new OpenLayers.Filter.Logical({
type: OpenLayers.Filter.Logical.OR,
filters: [
new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.EQUAL_TO,
property: "id_station",
value: 2
})]
});
filterStrategy.setFilter(filter);
});
I've built a working example available here: