Windows closing on SchedulerDataSource Add

2 posts, 0 answers
  1. Luciano Kaesemodel
    Luciano Kaesemodel avatar
    29 posts
    Member since:
    Apr 2007

    Posted 06 Jun 2014 Link to this post

    Hello there.

    I'm working in an implementation using SignalR and the Kendo Scheduler. When a new task is created (for exemple), the SchedulerDataSource transport send the connection hub id to the server as an additional parameter:

    parameterMap: function (options, operation) {
       if (operation == "destroy" && options.models) {
          return JSON.stringify({ taskId: options.models[0].Id, callerId: $.connection.hub.id });
       }
       if (operation !== "read" && options.models) {
          return JSON.stringify({ tasks: options.models, callerId: $.connection.hub.id });
       }
    }

    The server do whatever it has to do, and send a notification to every other user, except de caller:

    [HttpPost]
    public JsonResult CreateTask(List<ScheduledEvent> tasks, string callerId)
    {
       ...create task and other stuff

       //broadcast the newly created object to everyone except caller
       var hubContext = GlobalHost.ConnectionManager.GetHubContext<Notebooks.Hubs.SchedulerHub>();
       hubContext.Clients.AllExcept(callerId).UpdateSchedule(task);

       //return the object to caller
       return Json(task);
    }

    Once the other clients receive a new task from the hub, it is added to the SchedulerDataSource:

    hub.client.updateSchedule = function (scheduledEvent) {
       schedulerDataSource.add(scheduledEvent);
    }

    Everything seems to work fine, and it really took me some time to realize this behavior: if a client have the scheduler window open, this window is closed once the schedulerDataSource is updated. This is expected or am I doing something wrong?
  2. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2194 posts

    Posted 10 Jun 2014 Link to this post

    Hi Luciano,

    Current behavior is expected with the current logic - when you add new event through the dataSource, the scheduler is rebinding in order to render the added event which closes the edit window.  As from the provided information is not clear for us what is the exact scenario that you have - could you please provide the full scheduler code? This would help us advice you better how to proceed.

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