by Jorge Sousa » 29 Sep 2014 19:22
Hi
This is a very pertinent question.
To use .PrevRange or .NextRange, without doing anything else, you have to supplly all the data required not only the current view data - a week in your case, and all the other possible weeks.
If you call Scheduler.JQSchedulerOptions.Reload, you will order the scheduler to re request the current view data range (week in your case), if you call .PrevRange .NextRange it will order the scheduler to request the previous or next week respectively.
So to answer yo your question, you've to know what range / week will be previous and next, supply the items, and after you call .PrevRange or .NextRange.
ie,
In the Previous button, you have to
1- Know what the previous range will be: easy - the previous week.
2- Clear the Items and Load the previous week into the items.
and
3- Call Scheduler.JQSchedulerOptions.PrevRange.
or
3- Call Scheduler.JQSchedulerOptions.GotoDate(somedate in the previous week) and call Scheduler.JQSchedulerOptions.Reload
But we just added an new and great event: OnGetData, if you need to supply new data dynamically, when the StartDate and EndDate requested by the scheduler plugin, is not already converted to scheduler Items before, (or when we change to a view with a larger scope: week to month, fi),
type
TIWCGJQSchedulerGetDataEvent = procedure(Sender: TObject; const AStartDate,AEndDate: TDate; AView: TIWCGJQSchedulerView; ) of object;
property OnGetData: TIWCGJQSchedulerGetDataEvent
This is a great addition, very easy to implement and is ready for the next release.
With this event, you only need to worry about what data range is being requested, and supply at least data for that range.
and in the previous button call only .PrevRange and next button call only .NextRange.