This is a migrated thread and some comments may be shown as answers.

[Solved] Prev / Next Buttons - Change Increment?

2 Answers 144 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Justavian
Top achievements
Rank 1
Justavian asked on 30 Jul 2013, 09:33 PM
Is there any way to change the increment that the previous and next buttons execute?

I would like the timeline view to display perhaps 2 weeks worth of time, but it would be nice to have the prev / next buttons to only shift the view by 1 week.  After looking at the documentation, it wasn't clear if this was possible by default.

Presumably i could just create some javascript to hook into the buttons, and perhaps manually tell the control what view extents to display.

Any easier way?

-RP

2 Answers, 1 is accepted

Sort by
0
PhoenixAMS
Top achievements
Rank 1
answered on 02 Aug 2013, 12:11 AM
This worked for me:
protected void RadScheduler1_NavigationCommand(object sender, SchedulerNavigationCommandEventArgs e)
{
 
    if (e.Command == SchedulerNavigationCommand.NavigateToNextPeriod)
    {
        e.Cancel = true;
        RadScheduler1.SelectedDate = RadScheduler1.SelectedDate.AddHours(6);
    }

0
Justavian
Top achievements
Rank 1
answered on 02 Aug 2013, 12:36 AM
Phoenix,

Thanks for the reply.  I should have specified that i was using web service bindings, so that i couldn't do this on the server side.  I ended up just hooking into the buttons directly, and using stopPropogation and preventDefault to avoid the default action if the view was in timeline view.

Something like this:

$(
"a.rsPrevDay").click(function (e) {
    var oSched = $find("WhateverMyIdIs");
 
   //  Only execute if it's in timeline view - type 4.
    if(oSched.get_selectedView() == 4)
    {
     //  Make sure the scheduler doesn't still fire its own event.
     e.preventDefault();
     e.stopPropogation();
 
     var nNumDays = 7; // Actually, read this from a hidden field or some other source
 
     //  Get the current start date.
     var dtStart = oSched.get_selectedDate();
     
     //  Add the number of days specified - or subtract, in the case of previous
     dtStart = dtStart.setHours(dtStart.getHours() - (24 * nNumDays));
     
     //  Set the selected date.
     oSched.set_selectedDate(dtStart);
 
 
    }
}
Tags
Scheduler
Asked by
Justavian
Top achievements
Rank 1
Answers by
PhoenixAMS
Top achievements
Rank 1
Justavian
Top achievements
Rank 1
Share this question
or