Hi:
Currently the list view starts with the current day forward.
I’d like to change this to start with the Active Date, which may or may not be today.
So, if the user is on the month view, selects a day (any day) then switches to the list view the first date in the list should be the active date, not the current date.
Secondly, the list is limited (filtered) with only today forward, I’d like to change that behavior and display past and future events. So the user would start with the active date on top (that maybe today or some other date) and then scroll up and down the list. A scroll event would fire when more event data is needed. So the user could continue to scroll far into the future or past.
Any ideas on this? your samples have been great help.
Thanks again for your help and quick turn around…
Jim
Hi,
the actual date can be got by the following method:
var date = $$(“scheduler”).coreData.getValue();
To scroll a list to a certain item you can call showItem(id) method.
So, need to get an event id that will be at the top of the visible part of a list. If we assume that events are sorted by start_date, the following will solve the issue:
$$("scheduler").$$("buttons").attachEvent("onItemClick",function(){
var value = this.getValue();
if(value == "list"){
var id = getEventByDate($$("scheduler").coreData.getValue())
if(id)
$$("scheduler").$$("list").showItem(id);
}
});
function getEventByDate(date){
var list = $$("scheduler").$$("list");
var event;
for(var i=0; i < list.dataCount(); i++){
event = list.item(list.idByIndex(i));
if(dhx.Date.datePart(event.start_date).valueOf()>=dhx.Date.datePart(date).valueOf())
return event.id;
}
return null;
}
To show events starting from a certain date, you need to set scheduler.config.init_date beforee scheduler initialized:
scheduler.config.init_date = new Date(2011,0,1);