Loop through each date in timline days mode

Hi,

How to loop through each date in Timeline Days mode?

please suggest me regarding this :slight_smile:

thank you

Hi,
you can get the currently displayed date range using scheduler.getState method. Then,

  • if you want to iterate all dates in x-scale you could do a while-loop, incrementing minimal date by the step and unit of timeline scale
  • if you want to iterate each day of daily timeline (rows), you’ll need to use single day as an increment in a loop[code]var state = scheduler.getState();
    var from = new Date(state.min_date),
    to = new Date(range.max_date);

var timeline = scheduler.matrix[state.mode];

if(timeline){

while(+from < +to){
//… do something

from = scheduler.date.add(from, timeline.x_step, timeline.x_unit);

}

}[/code]

docs.dhtmlx.com/scheduler/api__s … state.html
docs.dhtmlx.com/scheduler/api__s … other.html