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

How to load Scheduler 'values' in kendo jQuery

1 Answer 61 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Kasper
Top achievements
Rank 1
Kasper asked on 18 Dec 2013, 02:25 PM
Hey Sup

Iam playing around with the scheduler from Kendo UI - and the scheduler is working fine atm. 
but but.. Iam trying to use some from the API demo at. 
API Demo

I have a html 'tool bar' as 
<div class="schedulerHeader">
    <p>
        <label>Current Date:</label><input id="currentDate" />
    </p>
    <p>
        <label>Current View:</label>
        <select id="views">
            <option value="agenda">Agenda</option>
            <option value="day">Day</option>
            <option value="month">Month</option>
            <option value="week">Week</option>
            <option value="workWeek">Work Week</option>
        </select>
    </p>
</div>

and javascript:
<script type="text/javascript">
    $(function () {
        var scheduler = $("#myScheduler").data("kendoScheduler");

        $("#currentDate").kendoDatePicker({
            value: new Date("2013/12/24"),
            change: function () {
                scheduler.date(this.value());
            }
        });


        $("#views").kendoDropDownList({
            value: scheduler.view(),
            change: function () {
                scheduler.view(this.value());
            }
        });

    });
</script>
all on in the same view as my scheduler, where I can change the view and date from the 'toolbar' hurra. 
but on site load the $("x").kendoDropDownList({ value: scheduler.view()...  is not set. I think it because that the scheduler wrapper isnt done loading. so the schedulder object in my js is 'null' when it load.
How should I handle this ? or how are you doing it in your demo, I am looking at the example project, but cant see a clear answer.

yeah I can use a timer... but no thanks :) 

- Kasper 

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 19 Dec 2013, 01:16 PM
Hello Kasper,

You should initialize the scheduler before the dropdownlists and then the reference will not be null. This is how we are doing it in our demo:

<script>
$(function() {
    $("#scheduler").kendoScheduler({ /* options */ });
 
     var scheduler = $("#scheduler").data("kendoScheduler");
 
    $("#date").kendoDatePicker({
        value: new Date("2013/6/13"),
        change: function() {
            scheduler.date(this.value());
        }
    });
 
    $("#views").kendoDropDownList({
        value: scheduler.view().name,
        change: function() {
            scheduler.view(this.value());
        }
    });


Regards,
Atanas Korchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Scheduler
Asked by
Kasper
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or