title: Kendo Scheduler, programmatically set values not updating dataModel
body: <ul>
  <li>Kendo Scheduler via javascript </li>
  <li>Custom Edit Template </li>
  <li>Edit Event -> programmatically setting a value on custom template controls</li>
  <li>Value shows in control, not included in dataModel</li>
  </ul>
  
  <p>I am implementing a Kendo Scheduler via javascript. I am using a custom edit template because there are several editable fields which are not native to the scheduler. One such field uses a kendo dropdownlist. I have subscribed to the edit event and in this event I get a handle on the dropdown and set its value. The UI element correctly shows the value I have set but when I save the scheduler the dropdownlist value is not included in the JSONified dataModel which I pass off to a CRUD handler. If I manually select an option from the dropdownlist it is included. I called the change event of the dropdownlist for giggles after the programmatic setting of its value. Still nothing. I tried this with textboxes, multiselections, numerictextboxes... they all fail to register their programmatically set values with the model.</p>
  
  <p>Ideas? Thanks.</p>
  
  <pre><code>$(function () {
      $("#scheduler").kendoScheduler({
          date: new Date("2015/4/14"),
          views: [
                  "day",
                  { type: "workWeek", selected: true, showWorkHours: true },
                  "week",
                  "month"
          ],
          allDayEventTemplate: $("#allDay-template").html(),
          eventTemplate: $("#event-template").html(),
          edit: function (e) {
              var location = e.container.find("[id=location]");
              location.kendoComboBox({
                  dataTextField: "text",
                  dataValueField: "value",
                  dataSource: GetLocations,
                  filter: "contains",
                  suggest: true
              });
  
              var taskReminder = e.container.find("[id=AddTaskReminder]");
              taskReminder.kendoNumericTextBox({
                  placeholder: "None",
                  format: "n0",
                  min: "0",
                  decimals: "0",
                  step: 15
              });
  
              var wnd = $(e.container).data("kendoWindow");
              wnd.setOptions({
                  width: 800,
                  height: 600
              });
  
            var clientID = $("#clientID");
           var ClientID = e.container.find("[id=ClientID]").data("kendoDropDownList");
           if (clientID.val() != "All") {
              ClientID.enable(false);
           }
  
              var Priority = $(e.container.find('[data-bind="value: Priority"]')).data("kendoDropDownList");
              if (e.event.isNew()) {
              if (clientID.val() != "All") {
                     ClientID.value(clientID.val());
                     e.container.find("[id=ClientID]").change();
              }
  
              var workerID = $("#workerID");
              var WorkerID = e.container.find("[id=workers]").data("kendoMultiSelect");
  
              if (workerID.val() != null) {
                         WorkerID.value(workerID.val());
                     e.container.find("[id=workers]").change();
              }
  
              Priority.value(2);
              (e.container.find('[data-bind="value: Priority"]')).change();
           }
  
              var taskName = e.container.find("[id=taskName]");
              taskName.kendoComboBox({
                  dataSource: GetTaskTypes,
                  dataTextField: "text",
                  dataValueField: "value",
                  filter: "contains",
                  suggest: true
              });
  
              var isAllDay = $(e.container.find('[id=isAllDay]'));
              var StartDateTime = $(e.container.find('[id=startdatetime]')).data("kendoDateTimePicker");
              var EndDateTime = $(e.container.find('[id=enddatetime]')).data("kendoDateTimePicker");
              var DueDateFirm = $(e.container.find('[id=DueDateFirm]'));
              var Reminder = $(e.container.find('[id=AddTaskReminder]')).data("kendoNumericTextBox")
              var TaskComment = $(e.container.find('[id=TaskComment]'));
  
              taskName.change(function () {
                  $("#TaskTypeName").val($(e.container.find("[id=taskName]")).data("kendoComboBox").text());
                  if ($(e.container.find("[id=taskName]")).data("kendoComboBox").select() != "-1") {
                      if (confirm("Apply task type defaults (overriding previous values)?")) {
                          $.ajax({
                              type: "GET",
                              cache: false,
                              url: "/home/schedule/remotetasks.asp?Action=GetDefaultTaskTypeValues&amp;DefaultTask=" + $(taskName).val(),
                              success: function (data) {
                                  DS = JSON.parse(data);
  
                                  Priority.value(DS[0].Priority);
  
                                  if (DS[0].AllDayEvent == "True") {
                                      isAllDay.prop("checked", true);
                                  }
                                  else {
                                      isAllDay.prop("checked", false);
  
                                      if (DS[0].DefaultStartTime != "") {
                                          var d = new Date(StartDateTime.value());
                                          d.setHours(DS[0].DefaultStartHour);
                                          d.setMinutes(DS[0].DefaultStartMinute);
                                          StartDateTime.value(d);
                                      }
  
                                      if (DS[0].DefaultEndTime != "") {
                                          var d = new Date(EndDateTime.value());
                                          d.setHours(DS[0].DefaultEndHour);
                                          d.setMinutes(DS[0].DefaultEndMinute);
                                          EndDateTime.value(d);
                                      }
                                  }
                                  isAllDay.change();
  
                                  Reminder.value(DS[0].DefaultReminderMinutes);
                                  TaskComment.val(DS[0].TaskComment);
                              }
                          });
                      }
                  }
              });
          },
          save: function (e) {
              if (e.container != null) {
              // AssignedTaskName req val
  
                  // Dates req val
                  var isAllDay = e.container.find("[id=isAllDay]");
                  var startdatetime = e.container.find("[id=startdatetime]");
                  var startdate = e.container.find("[id=startdate]");
                  var enddatetime = e.container.find("[id=enddatetime]");
                  var startdatereq = e.container.find("[id=startdatereq]");
                  var enddatereq = e.container.find("[id=enddatereq]");
  
                  var isAllDay = $(startdate).is(":visible");
  
                  if (isAllDay) {
                      if ($(startdate).val() == "") {
                          //alert('invalid startdate');
                          e.preventDefault();
                          if ($(startdatereq).hasClass('hidden'))
                              startdatereq.removeClass('hidden');
                      }
                      else {
                          //alert('valid startdate');
                          if (!$(startdatereq).hasClass('hidden'))
                              startdatereq.addClass('hidden');
                      }
                  }
                  else {
                      if ($(startdatetime).val() == "") {
                          //alert('invalid startdatetime');
                          e.preventDefault();
                          if ($(startdatereq).hasClass('hidden'))
                              startdatereq.removeClass('hidden');
                      }
                      else {
                          //alert('valid startdatetime');
                          if (!$(startdatereq).hasClass('hidden'))
                              startdatereq.addClass('hidden');
                      }
                      if ($(enddatetime).val() == "") {
                          //alert('invalid enddatetime');
                          e.preventDefault();
                          if ($(enddatereq).hasClass('hidden'))
                              enddatereq.removeClass('hidden');
                      }
                      else {
                          //alert('valid enddatetime');                        
                          if (!$(enddatereq).hasClass('hidden'))
                              enddatereq.addClass('hidden');
                      }
                  }
              }
          },
          editable: {
              template: kendo.template($("#customEditorTemplate").html())
          },
          moveEnd: function (e) {
              if (!confirm("Are you sure you want to update this event?")) {
                  e.preventDefault();
              }
  
          },
          resizeEnd: function (e) {
              if (!confirm("Are you sure you want to update this event?")) {
                  e.preventDefault();
              }
          },
          dataSource: {
              batch: true,
              sync: function () {
                  this.read();
              },
              transport: {
                  create: {
                      url: "/home/schedule/remotemanagecalendar.asp?Action=create",
                      dataType: "json"
                  },
                  read: {
                      url: "/home/schedule/remotemanagecalendar.asp?Action=read",
                      dataType: "json"
                  },
                  update: {
                      url: "/home/schedule/remotemanagecalendar.asp?Action=update",
                      dataType: "json"
                  },
                  destroy: {
                      url: "/home/schedule/remotemanagecalendar.asp?Action=destroy",
                      dataType: "json"
                  },
                  parameterMap: function (options, operation) {
                      if (operation === "read") {
                          var scheduler = $("#scheduler").data("kendoScheduler");
  
                          var result = {
                              start: scheduler.view().startDate(),
                              end: scheduler.view().endDate(),
                              clientid: $("#clientID").val(),
                              workerid: $("#workerID").val(),
                              taskstatus: $("#taskStatus").val()
                          }
  
                          return { models: kendo.stringify(result) };
                      }
                      else if (operation === "create" &amp;&amp; options.models) {
                          return { models: kendo.stringify(options.models) + "||" + $("#TaskTypeName").val() };
                      }
                      else if (operation === "update" &amp;&amp; options.models) {
                          return { models: kendo.stringify(options.models) + "||" + $("#TaskTypeName").val() };
                      }
                      else if (operation !== "read" &amp;&amp; options.models) {
                          return { models: kendo.stringify(options.models) };
                      }
                  }
              },
              schema: {
                  model: {
                      id: "id",
                      fields: {
                          id: { from: "AssignedTaskID", type: "number" },
                          taskTypeID: { from: "TaskTypeID", type: "int" },
                          title: { from: "AssignedTaskName", type: "string" },
                          start: { from: "StartDateTime", type: "date", validation: { required: true } },
                          end: { from: "EndDateTime", type: "date" },
                          isAllDay: { from: "isAllDay", type: "boolean" },
                          dueDateFirm: { from: "DueDateFirm", type: "boolean" },
                          reminderMinutes: { from: "ReminderMinutes", type: "int" },
                          ClientID: { from: "ClientID", type: "int" },
                          Priority: { from: "Priority", type: "int" },
                          workers: { from: "Workers", nullable: true },
                          TaskComment: { from: "TaskComment", type: "string" },
                          locationid: { from: "LocationID", type: "string" }
                      }
                  }
              }
          }
      });
  });
  
  var GetTaskTypes = new kendo.data.DataSource({
      transport: {
          read: {
              url: "/home/schedule/remotetasks.asp?Action=GetAddTaskTypes",
              dataType: "json"
          }
      }
  });
  
  var GetClientIDs = new kendo.data.DataSource({
      transport: {
          read: {
              url: "/home/schedule/remotetasks.asp?Action=GetAddClients",
              dataType: "json"
          }
      }
  });
  
  var GetPriorities = new kendo.data.DataSource({
      transport: {
          read: {
              url: "/home/schedule/remotemanagecalendar.asp?Action=GetPriorities",
              dataType: "json"
          }
      }
  });
  
  var GetAddWorkers = new kendo.data.DataSource({
      transport: {
          read: {
              url: "/home/schedule/remotetasks.asp?Action=GetAddWorkers",
              dataType: "json"
          }
      }
  });
  
  var GetLocations = new kendo.data.DataSource({
      transport: {
          read: {
              url: "/home/schedule/remotemanagecalendar.asp?Action=GetLocations",
              dataType: "json"
          }
      }
  });
  
  $("#AddTaskReminder").kendoNumericTextBox({
      placeholder: "None",
      format: "n0",
      min: "0",
      decimals: "0",
      step: 15
  });
  </code></pre>