Customizing the scheduler editor

2 posts, 0 answers
  1. Michael
    Michael avatar
    1 posts
    Member since:
    Feb 2014

    Posted 05 Mar 2014 Link to this post

    Hi,I have a problem with data binding using a custom template for the editor for the Scheduler component.When double clicking an item in the scheduler my dialog is displayed, for for some reason, I am only able to databind against the properties of the ISchedulerEvent interface and not all the other properties of my ViewModel.ViewModel

    public class MyViewModel : ISchedulerEvent
            buplic int MyId { get; set;}  
            public bool MyBool{ get; set;}
            public string MyString { get; set; }
            #region ISchedulerEvent
            public string Title { get; set; }
            public string Description { get; set; }
            public bool IsAllDay { get; set; }
            public DateTime Start {get;set;}
            public DateTime End { get; set; }
            public string StartTimezone { get; set; }
            public string EndTimezone { get; set; }
            public string RecurrenceRule { get; set; }
            public string RecurrenceException { get; set; }
    View Example:
          .Views(views =>
              views.WeekView(weekView => weekView.Selected(true));
          .DataSource(d =>
              d.Read(read => read.Url("/MyController/MyRead"));
              d.Update(update => update.Url("/MyController/MyUpdate"));
              d.Create(create => create.Url("/MyController/MyCreate"));
              d.Destroy(destroy => destroy.Url("/MyController/MyDelete"));
              d.Model(model =>
                  model.Id(f => f.MyId);
          .BindTo(new [] {
                        new ServiceWindowViewModel{
                            MyId = 1,
          MyBool = true,
          MyString = "Yay this is my string",
          Title = "title not used",
                            Description = "description not used",
                            End = DateTime.Now.AddHours(2),
                            EndTimezone = null,
                            IsAllDay = false,
                            RecurrenceException = null,
                            RecurrenceRule = null,
                            Start = DateTime.Now,
                            StartTimezone = null
          .Editable(editable => {
        )<script id="editor" type="text/x-kendo-template">
    <div class="k-edit-label"><label for="title">Title</label></div>
    <div class="k-edit-field" data-container-for="title"><input type="text" class="k-input k-textbox" name="title" data-bind="value: title"></div>
    <div class="k-edit-label"><label for="mystring">My String</label></div>
    <div class="k-edit-field" data-container-for="mystring"><input type="text" class="k-input k-textbox" name="mystring" data-bind="value: mystring"></div>
    Now My String editor box is displayed correctly... but the data is not displayed from the property of the view model... what am I doing wrong?Is there some other way to configure a custom edit popup for the Scheduler item? E.g. the editor for the grid seem to work better and is able to display all properties of my ViewModel correctly.Thanks,
  2. Alexander Popov
    Alexander Popov avatar
    1432 posts

    Posted 07 Mar 2014 Link to this post

    Hello Michael,

    Fields that do not come from the ISchedulerEvent interface preserve their exact names, so the template should be referring to the field using "MyString" instead of "mystring".

    Alexander Popov

    DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

Back to Top