PDA

View Full Version : Ext.each setting time for adding data



aragonnette
1 Jun 2011, 12:11 AM
hi ,

i am working with extjs and openlayers . i can add my data with below code.. but i want to add my data with 1 sec intervals... so second data will be added after 1 sec from first data...




Ext.each(features, function(s) {
var point = new OpenLayers.Geometry.Point(s.coord[0],s.coord[1]);
var add_point = new OpenLayers.Feature.Vector(point,null,null);

map.vectorlayer.addFeatures(add_point);

}];




with this code all point is added completely. i want some time interval between points

thks

fay
1 Jun 2011, 3:07 AM
Have you looked at Ext.TaskMgr (http://dev.sencha.com/deploy/ext-3.3.1/docs/?class=Ext.TaskMgr)? The start method can take an interval (frequency in milliseconds with which the task should be invoked) and repeat (number of times to invoke the task before stopping automatically), which might meet your requirement.

aragonnette
1 Jun 2011, 5:28 AM
because of decoding json data then adding with ext.each, ext task didnt work for me ..
thks...

mitchellsimoens
2 Jun 2011, 5:36 AM
Ext.each(features, function(s) {
.....
}.defer(1000));

Never used it inside Ext.each but could work but I also doubt it leaning toward the doubt it. May just need to use setTimeout to go over things.