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

SchedulerDataSource, Cannot read property 'data' of undefined

1 Answer 178 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 2
Grant asked on 04 Oct 2016, 08:10 AM


I've created a widget that uses the KendoScheuler inside a kendoWindow and sets its DataSource dynamically. Code below, shortened for brevity:


function openWindow(optionOverrides) {
  var options = {
     * @type {Array |}
     * @required
     * The dataSource where existing events are read from, can be a or a JavaScript Array.
     * If an array is used a new will be created with the 'data' attribute set as the array
    dataSource: null
  //Validate a dataSource exists
  if (!validateArgument(optionOverrides.dataSource, ["object"])) {
    console.error("SchedulerDataSource of incorrect type. Expected: object; found: " + typeof optionOverrides.dataSource);
    return false;
  } else {
    if ((optionOverrides.dataSource).constructor == Array) {
      //If the optionOverrides.dataSource is an array, use it to create a new containing the array data
      var schedulerDS = new{
        data: optionOverrides.dataSource
      options.dataSource = schedulerDS;
    } else if ((optionOverrides.dataSource).constructor == {
      //Use optionOverrides.dataSource if it is already a
      options.dataSource = optionOverrides.dataSource;
    } else {
      console.error("optionOverrides.dataSource object not of type Array or");
      return false;
  var dfd = $.Deferred();
  var result = null;
  $("<div />")
    .attr("id", "window-schedulerWindow")
      visible: false,
      modal: true,
      resizable: false,
      title: options.title,
      activate: function(e) {
        //Hide the headers of the scheduler
        var timePickerScheduler = $("#scheduler-scheduleTimePickerWindow-timePicker").data("kendoScheduler");
        //Set data source after initialization. Prevents data being loaded before the scheduler is ready
      open: function(e) {
        var timePickerScheduler = $("#scheduler-scheduleTimePickerWindow-timePicker").kendoScheduler({
          /* Attributes removed for Brevity */

         edit: function(e) {

               e.preventDefault(); //prevent default event editing

               //Retrieve and sync the dataSource with the new event generated in the 'add' callback
              var dataSource = this.dataSource;


  return dfd.promise();

The Problem:
So the issue Im having is that if the SDS is created fresh from an array of Event Objects, everything works fine, however, if I specify an already existing SDS, that uses remote data, and then start dragging and resizing events, I get the error: "Cannot read property 'data' of undefined", which points to statement 'dataSource.sync();' in the 'edit' event of my scheduler.

Is there some kind of sync trying to happen with the remote SDS? I monitored my network activity and didnt see anything.

Please advise, Thanks,



1 Answer, 1 is accepted

Sort by
Telerik team
answered on 06 Oct 2016, 05:57 AM

Hello Grant,

Indeed, the DataSource sync method will try to push the changes to the server. Therefore, you should verify that the DataSource transport is correctly configured for CRUD operations.

Telerik by Progress
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
Data Source
Asked by
Top achievements
Rank 2
Answers by
Telerik team
Share this question