I have a filter control which works nicely. However, when I try to reset/remove the filter, I don't get the original features back. The debugger shows my features array as still only being the reduced number of features, yet shows the filter strategy as being inactive.
I set up the strategy on layer instantiation like this:
this.strategies = { bbox: new OpenLayers.Strategy.BBOX(), filter: new OpenLayers.Strategy.Filter(),};// initialisation stuff here ...layer = new OpenLayers.Layer.Vector( this.layerName, { projection: this.projection, strategies: [ this.strategies.bbox, this.strategies.filter, ], protocol: protocol, styleMap: styleMap, });I set the filter like this:
filter: function () { var olLayer = this.olLayer; var attribute = document.getElementById ( "layer-search-attribute" ).value; var value = document.getElementById( "layer-search-value" ).value; var type = OpenLayers.Filter.Comparison.LIKE; var filter = new OpenLayers.Filter.Comparison({ type: type, property: attribute, value: value, }); this.strategies.filter.activate(); this.strategies.filter.setFilter( filter ); olLayer.redraw(); // back to the map page $.mobile.changePage( "#mappage" );}, // end filter ()And I remove it like this:
resetFilter: function () { console.log("Removing filter on:", this.layerName ); var olLayer = this.olLayer; this.strategies.filter.deactivate(); olLayer.redraw(); // back to the map page $.mobile.changePage( "#mappage" );}, // end resetFilter ()I've also tried olLayer.refresh({ force: true }) without success.
Can anyone help?
أكثر...
I set up the strategy on layer instantiation like this:
this.strategies = { bbox: new OpenLayers.Strategy.BBOX(), filter: new OpenLayers.Strategy.Filter(),};// initialisation stuff here ...layer = new OpenLayers.Layer.Vector( this.layerName, { projection: this.projection, strategies: [ this.strategies.bbox, this.strategies.filter, ], protocol: protocol, styleMap: styleMap, });I set the filter like this:
filter: function () { var olLayer = this.olLayer; var attribute = document.getElementById ( "layer-search-attribute" ).value; var value = document.getElementById( "layer-search-value" ).value; var type = OpenLayers.Filter.Comparison.LIKE; var filter = new OpenLayers.Filter.Comparison({ type: type, property: attribute, value: value, }); this.strategies.filter.activate(); this.strategies.filter.setFilter( filter ); olLayer.redraw(); // back to the map page $.mobile.changePage( "#mappage" );}, // end filter ()And I remove it like this:
resetFilter: function () { console.log("Removing filter on:", this.layerName ); var olLayer = this.olLayer; this.strategies.filter.deactivate(); olLayer.redraw(); // back to the map page $.mobile.changePage( "#mappage" );}, // end resetFilter ()I've also tried olLayer.refresh({ force: true }) without success.
Can anyone help?
أكثر...