strategy refresh ol2, how stop it?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

strategy refresh ol2, how stop it?

emeotero
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? <nabble_embed> ... 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() }) }), }); </nabble_embed> use Ajax to execute the query and load the store. I want to stop the strategy refresh until the next query.