Reset the timeline scheduler when the User Changes the TimeLine Date Range

2 posts, 0 answers
  1. Steve
    Steve avatar
    6 posts
    Member since:
    Jun 2014

    Posted 04 Dec 2014 Link to this post

    I am using the monthly timeline for a project and have a large amount of events that I am loading into the timeline, and that number will only grow overtime.  So what I am trying to do is only load events for the given month that is being viewed.  I have the data coming in correctly but I am not able to reset the dataSource.  

    The steps I am taking to set the new dataSource are below:

    var scheduler = $("#accountManagerHomeTimeline").data("kendoScheduler");

    newData = [{client_name: "ALLIED-THA ST. VINCENT", end: "2014/11/14", end_date_tooltip_formated: "11/14", id: 2198, isAllDay: true, key: "#e826b8", placement_count: 1, start: "2014/11/14", start_date_tooltip_formated: "11/14", text: "Allied-tha st. vincent", title: "st. vincent", total_cost: "$548.42", value: 2198 }]

    var newDataSource = new kendo.data.DataSource({ data: newData })

    scheduler.setDataSource.data(newDataSource)

    I get the following error:

    ypeError: undefined is not a functionmessage: "undefined is not a function"stack: (...)get stack: function () { [native code] }arguments: nullcaller: nulllength: 0name: ""prototype: Object__proto__: function Empty() {}<function scope>set stack: function () { [native code] }arguments: nullcaller: nulllength: 1name: ""prototype: Object__proto__: function Empty() {}<function scope>__proto__: Errorconstructor: function TypeError() { [native code] }name: "TypeError"stack: undefined__proto__: d
     

     Below is a gist to my function that creates the timeline:

     https://gist.github.com/sdanko11/4ce68ea7f6d76a3b858e  

    Not really sure what the issue is but any help would be greatly appreciated.     







  2. T. Tsonev
    Admin
    T. Tsonev avatar
    2815 posts

    Posted 08 Dec 2014 Link to this post

    Hi,

    All seems fine with your code with the exception that setDataSource should be called as a method:
    var newDataSource = new kendo.data.DataSource({ data: newData });
    scheduler.setDataSource(newDataSource);


    Or perhaps you've meant to replace the current data source data without creating a new instance:
    scheduler.dataSource.data(newDataSource);

    These functionally equivalent, but the second option is slightly more efficient.
    I hope this helps.

    Regards,
    T. Tsonev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top