Hi,
I'm trying to implement autorefresh on a InMemoryFeatureLayer dues to memory leaks when using the map in an update panel and a timer to refresh.
Starting with the server side I found that once you set the refresh going it fires always at that rate. i.e. you cannot update the refresh rate.
On the client side I found that you had better control over the refresh rate if you set it up on OnMapCreated and it was easier to stop the call back, however updating the refresh rate is still problematic and intermittent.
It would sometimes work but there seems to be a maximum value that you can set the initial autoRefreshMilliseconds value to, other wise it will not fire at all. Also I'm unsure if i should be setting the .tick property.
Have you any
function OnMapCreated(Map1) { } if (refreshRate < 5 && isChecked == true) { var map = Map1.GetOpenLayersMap(); var targetLayer = map.getLayersByName(targetLayerName); if (isChecked == true) {
var targetLayer = Map1.getLayersByName('Metrics');
// 0 does nt work
targetLayer[0].autoRefreshMilliseconds = 60000;
targetLayer[0].tick = true;
function ToggelAutoRefresh(isChecked, refreshRate, targetLayerName) {
if (!isNumeric(refreshRate) || refreshRate == null) {
alert('Refresh Rate must be numeric');
return;
}
alert('Refresh Rate must be greater than 5 seconds');
return;
}
if (map.getLayersByName(targetLayerName).length < 1) {
// Developer message. No need to localise
alert('Target Layer ' + targetLayerName + ' does not exist');
}
targetLayer[0].autoRefreshMilliseconds = 10000;
targetLayer[0].tick = true;
targetLayer[0].redraw();
}
else {
targetLayer[0].autoRefreshMilliseconds = 0;
targetLayer[0].tick = false;
}
advice on the code below.
Thanks, Liam