Adding resources to scheduler in external javascript event handlers

3 posts, 0 answers
  1. Mohomed
    Mohomed avatar
    22 posts
    Member since:
    Sep 2017

    Posted 12 Oct Link to this post

    var scheduler = $("#scheduler").data("kendoScheduler");
                        var filterR = {
                            logic: "or",
                            filters: [
                              { field: "workCent", operator: "eq", value: 'F1' }
                            ]
                        };
                        scheduler.dataSource.filter(filterR);
                        scheduler.view("month");

    Hi, I've come across many examples where filters are added to the scheduler in javascript functions outside the definition of the scheduler as shown above. My issue is how to add resources like this in an external javascript function/event handler. I tried doing it as below and many other ways, but it doesn't seem to work. Does anyone know how ?

    var ds = $("#scheduler").data("kendoScheduler");
    var orderNoResource = {
                            field: "orderId",
                            title: "Order",
                            dataSource: [
                                { text: "Order 1", value: '200023', color: "#f8a398" },
                                { text: "Order 2", value: '200027', color: "#51a0ed" },
                                { text: "Order 3", value: '200033', color: "#56ca85" },
                                { text: "Order 3", value: '200025', color: "#45ca85" }
                            ]
                        };
     
    ds.resources[0] = orderNoResource;
     
    ds.view("month");
  2. Tyler
    Tyler avatar
    38 posts
    Member since:
    Feb 2017

    Posted 12 Oct in reply to Mohomed Link to this post

    You will have to destroy the widget and re-initialize with the new resource you want. 

    Here is a forum post on the subject.

    And here is a link to the destroy method of the scheduler that is linked in that forum post.

     

    So whatever function is handling the event you want to change your resources with, destroy the scheduler, create a new one with the your new resources.

  3. Mohomed
    Mohomed avatar
    22 posts
    Member since:
    Sep 2017

    Posted 12 Oct in reply to Tyler Link to this post

    Thanks for the Reply, I figured it out.
Back to Top