Scheduler Current Time view

7 posts, 0 answers
  1. Cush
    Cush avatar
    88 posts
    Member since:
    Apr 2010

    Posted 11 Feb 2011 Link to this post

    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
  2. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 14 Feb 2011 Link to this post

    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.
  3. Cush
    Cush avatar
    88 posts
    Member since:
    Apr 2010

    Posted 14 Feb 2011 Link to this post

    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
  4. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 15 Feb 2011 Link to this post

    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.
  5. Cush
    Cush avatar
    88 posts
    Member since:
    Apr 2010

    Posted 16 Feb 2011 Link to this post

    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
  6. Cush
    Cush avatar
    88 posts
    Member since:
    Apr 2010

    Posted 17 Feb 2011 Link to this post

    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
  7. Cush
    Cush avatar
    88 posts
    Member since:
    Apr 2010

    Posted 20 Feb 2011 Link to this post

    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
Back to Top