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

[Solved] Client side VisibleRangeStart/End

2 Answers 335 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
HHalim
Top achievements
Rank 2
HHalim asked on 06 Jun 2008, 05:44 PM
How do I get the VisibleRangeStart/End from the client side? Couldn't find it in the documentation. Or if not available how to pass the current view(day/week/month) to the radwindow? I have access to the radscheduler object from OnClientAppointmentInserting/Editing event.

I need to pass these values to the radwindow for the custom advanced edit form.
This will allow for a much more efficient data load than loading all the appointments into the scheduler in the radwindow.


Thanks.

2 Answers, 1 is accepted

Sort by
0
Dimitar Milushev
Telerik team
answered on 10 Jun 2008, 11:41 AM
Hello Hart,

It's easy to get the VisibleRangeStart on the client-side from the RadScheduler object - 'radScheduler.get_firstDayStart()' will return exactly what you need.

Getting the End-time is a bit tricky though. You will have to calculate it manually and the duration of the 'Visible period' depends on the selected view. The currently selected view is returned by 'radScheduler.get_selectedView()'.

Since working with dates in Javascript is not as easy as one would like, the following code may seem a bit complicated, but here is an example on how to get the first day start and add 7 days if a WeekView is selected:

        function addDays(date, numberOfDays) 
        { 
            return new Date(date.getTime() + new Date(0).setDate(numberOfDays+1)); 
        } 
     
        function showDates() 
        { 
            var radScheduler = $find('RadScheduler1'); 
             
            if(radScheduler.get_selectedView() == Telerik.Web.UI.SchedulerViewType.WeekView) 
            { 
                var startDate = radScheduler.get_firstDayStart(); 
                var endDate = addDays(startDate, 7); 
             
                alert(startDate + " - " + endDate); 
            } 
        } 

I hope this helps

Best wishes,
Dimitar Milushev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
HHalim
Top achievements
Rank 2
answered on 10 Jun 2008, 06:49 PM
Yes, this helps greatly. Thank you!

Tags
Scheduler
Asked by
HHalim
Top achievements
Rank 2
Answers by
Dimitar Milushev
Telerik team
HHalim
Top achievements
Rank 2
Share this question
or