Get instance of kendo scheduler integrated by angularjs

6 posts, 1 answers
  1. Alex
    Alex avatar
    6 posts
    Member since:
    Nov 2017

    Posted 28 Nov Link to this post

    Hi,

    I have checked this document: https://docs.telerik.com/kendo-ui/AngularJS/introduction#widget-references
    to get the instance of kendo scheduler and enable single click to add/edit event on my scheduler https://dojo.telerik.com/@alexdd/UYuke

    But it doesn't work as the document, could you correct me to get it? Thanks

  2. Dimitar
    Admin
    Dimitar avatar
    224 posts

    Posted 29 Nov Link to this post

    Hello Alex,

    In AngularJS the controller should be used to setup the initial state of the $scope object and add behavior to it. It should not be used for manipulating DOM elements, as its main purpose is to consolidate business logic. Refer to the AngularJS documentation on Controllers for additional information.

    To achieve the desired behavior, you can add a simple button to the page and attach an ng-click directive on it as follows:
    <button class="k-button" ng-click="getSchedulerData()">Print Scheduler data</button>

    Then, we can attach a function to the $scope variable, retrieve the widget instance and then use the Scheduler's data() method to output the currently expanded events:
    $scope.getSchedulerData = function(e) {
      console.log($scope.myScheduler.data());
    }

    I have prepared a Dojo example, where the above behavior can be observed.

    Regards,
    Dimitar
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Alex
    Alex avatar
    6 posts
    Member since:
    Nov 2017

    Posted 29 Nov in reply to Dimitar Link to this post

    Hello Dimitar,

    I have tried your example, it works fine to get the currently expanded events. But its doesn't work on my issue, i would like to get the scheduler instance to make single click for add/edit events as in this ticket and dojo here, but they are using jQuery. 
    So that, i need to make it work same like that but by angularjs. 

    Thanks,

    Alex

     

     

  4. Alex
    Alex avatar
    6 posts
    Member since:
    Nov 2017

    Posted 29 Nov in reply to Alex Link to this post

    Here is my dojo example, i just even just get only the current instance:

    var scheduler = $scope.myScheduler.data();
    console.log(scheduler);
  5. Answer
    Plamen
    Admin
    Plamen avatar
    2821 posts

    Posted 01 Dec Link to this post

    Hi,

    One possible way to handle the issue is to use the dataBound event of the scheduler to add the handler as for example it is done in this dojo.

    Regards,
    Plamen
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  6. Alex
    Alex avatar
    6 posts
    Member since:
    Nov 2017

    Posted 01 Dec Link to this post

    Thanks Plamen, it works perfect.
Back to Top