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

Scheduler Current Time view

6 Answers 69 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Cush
Top achievements
Rank 1
Cush asked on 11 Feb 2011, 10:16 PM
Hi All

I want to get the scheduler to scroll to the current time when the page is loaded,
I have found this article but it doesn't seem to function?

Any ideas would be most appreciated.

Many Thanks

Regards

Darren

6 Answers, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 14 Feb 2011, 09:10 AM
Hi Cush,

I've tested the KB article personally and I can assure it works. It's not mentioned but you can set the ShowFullTime property of the RadScheduler to "true". That way the current view will start form 12 AM and you'll see how the Scheduler is scrolled to 8 am.

Please take a look at the attached project and let me know if you have further questions.

Regards,
Veronica Milcheva
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Cush
Top achievements
Rank 1
answered on 14 Feb 2011, 09:34 PM
Hi Veronica

Thanks for getting back to me,
I have taken your code and applied it to my demo Default2.aspx,

I will open a support ticket as i cannot upload the zip file here!

I would very much appreciate it if you could take a look at it because i still cannot make it function.
I am probably missing something silly?

Best Regards

Darren
0
Veronica
Telerik team
answered on 15 Feb 2011, 10:51 AM
Hello Cush,

For those who follow the thread:

The problem was in that the RadScheduler was wrapped with RadSplitter. In this scenario pageLoad() is too early to scroll to selected timeslot. You need to subscribe to the OnClientExpanding event of the RadSlidingPane that wraps the Scheduler:

<telerik:RadSlidingPane ID="SchedSlidingPane" runat="server" Width="1000px" Title="Resource Schedule"
                       BackColor="#002440" MaxWidth="1000" Scrolling="Y" OnClientExpanding="OnClientExpanding">
                           <telerik:RadScheduler ID="RadScheduler1" runat="server" OnDataBound="RadScheduler1_DataBound"
                               Skin="Web20" OverflowBehavior="scroll" Width="100%" Height="100%" EnableDescriptionField="True"
                               StartInsertingInAdvancedForm="True" DataDescriptionField="Description" DataEndField="appEnd"
                               DataKeyField="appID" DataRecurrenceField="appRecRule" DataRecurrenceParentKeyField="appRecParentID"
                               DataReminderField="appRemind" DataSourceID="ObjectDataSource1" DataStartField="appStart"
                               DataSubjectField="appSubject" EnableAdvancedForm="true" StartEditingInAdvancedForm="true"
                               AppointmentStyleMode="Default" ShowFullTime="True" OnAppointmentInsert="RadScheduler1_AppointmentInsert"
                               OnClientAppointmentMoving="AppointmentMovingHandler" CustomAttributeNames="schedColour"
                               OnTimeSlotCreated="RadScheduler1_TimeSlotCreated">

and replace the pageLoad() with the name of the handler:

function OnClientExpanding(sender, args) {
                   var scheduler = $find('<%= RadScheduler1.ClientID %>');
                   var scrolledIntoViewSlot = $telerik.getElementByClassName(scheduler.get_element(), "TimeSlotCssFor8AM", "td");
                   if (scrolledIntoViewSlot)
                       setTimeout(function () { scrolledIntoViewSlot.scrollIntoView(); }, 200);
               }

All the best,
Veronica Milcheva
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Cush
Top achievements
Rank 1
answered on 16 Feb 2011, 09:14 AM
Hi Veronica

I am pretty sure i have tried this already but i will try again and come back to you.

Many Thanks

Regards

Darren
0
Cush
Top achievements
Rank 1
answered on 17 Feb 2011, 06:47 PM
Hi Veronica

I tried using the OnClientExpanding and i does not fire on the first initiation only subseqent ones, So i have used the OnClientExpanded and it seems to be working fine.

Many thanks for your help.

Regards

Darren
0
Cush
Top achievements
Rank 1
answered on 20 Feb 2011, 03:14 PM
Hi All

I though i would post this here as i think it is a good solution to scrolling to the Current time in the scheduler,
I found this Article

I modified the code slightly and use it with the OnClientExpanded on the Sliding pane.
It works a treat.
function schedScroll() {
                    try {
                        var $ = $telerik.$;
                        var sender = $find("<%= RadScheduler1.ClientID %>");
                        var now = new Date();
                        $(".rsContentTable:visible td", sender.get_element()).each(function (i) {
                            var currentTimeSlot = sender.get_activeModel().getTimeSlotFromDomElement($(this).get(0));
                            if (currentTimeSlot.get_startTime().getHours() == now.getHours()) {
                                var scrolledIntoViewSlot = $(this).get(0);
                                if (scrolledIntoViewSlot)
                                    scrolledIntoViewSlot.scrollIntoView();
                            
                        });
                    }
                    catch (e) {
                        alert(e.Message);
                    }
                }

Best Regards

Darren
Tags
Scheduler
Asked by
Cush
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Cush
Top achievements
Rank 1
Share this question
or