Discussion:
strategy refresh ol2, how stop it?
(too old to reply)
emeotero
2016-10-13 15:03:53 UTC
Permalink
Hi,(sorry for my English)I've a GeoJson vecLayer and I use a PHP postgress
query , the result goes to a Geoext Store that i reload after the query and
show the results on the map perfectly. I decided to show those results in a
cluster, it's makes me halfway, until you don't reload the page it doesn't
load well. I got a strategy to refresh the vecLayer, but only works if i put
a refresth interval. I want to stop this interval and it waits for the next
run. For more than i look for this i don`t find an example of how to do it.
Does anyone know how to do it? ...var interval = 1000;...vecLayer2 = new
OpenLayers.Layer.Vector("vecLayer2", { projection:
map.displayProjection, /*preFeatureInsert: function(feature) {
feature.geometry.transform(fromProjection,toProjection); },*/
protocol: new OpenLayers.Protocol.HTTP({
url:'data/xxx'+sessionid+'.json', format: new
OpenLayers.Format.GeoJSON(), }), strategies: [ new
OpenLayers.Strategy.Fixed(), new OpenLayers.Strategy.Cluster({distance:
20}), new OpenLayers.Strategy.Refresh({active:true, interval:interval}),
], styleMap:new OpenLayers.StyleMap({ "default": style,
"select":{ fillColor:"#e3f0ff", strokeColor:"#1eas1a" }
}), displayInLayerSwitcher: false, renderers:["Canvas", "SVG", "VML"],
})...store = new GeoExt.data.FeatureStore({ autoDestroy: true,
layer:vecLayer2, root:'features', fields:[ {name: 'id', type: 'double'},
{name: 'name_es', type: 'string'}, {name: 'description', type: 'string'},
], proxy: new GeoExt.data.ProtocolProxy({ protocol: new
OpenLayers.Protocol.HTTP({ url: "data/xxx"+sessionid+".json",
format: new OpenLayers.Format.GeoJSON() }) }), });use Ajax to execute
the query and load the store.I want to stop the strategy refresh until the
next query.



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/strategy-refresh-ol2-how-stop-it-tp5290592.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
Loading...