CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Scheduler NextRange

by etwoss » 29 Sep 2014 14:07

Hi

I'm showing the calendar only in week view, i only want to get data from the week shown from the database
So i have a Next and Prev button, code: NextRange and PreviousRange

I'm not quit sure what the best flow is on the click event:

1) GetDatabase records
2) clear schedular eventlist and refill it with new events from database
3) Scheduler.Reload(true)
4) call NextRange or PreviousRange

or
1) GetDatabase records
2) clear schedular eventlist and refill it with new events from database
3) call NextRange or PreviousRange
3) Scheduler.Reload(true)

What your idea?

Eric
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58

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.
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by etwoss » 29 Sep 2014 19:39

Hi

Great!!!!!

Eric
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58

by etwoss » 02 Oct 2014 08:01

Hi

Release Notes:
JQScheduler:
- Added: New event OnGetData, to have the opportunity to change the Items, given the start and end dates.

When is this event called?

Eric
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58

by Jorge Sousa » 02 Oct 2014 09:48

hi

This event is called whenever the grid needs data.
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58


Return to JQScheduler

Who is online

Users browsing this forum: No registered users and 4 guests

Contact Us.