This is a migrated thread and some comments may be shown as answers.

Get instance of kendo scheduler integrated by angularjs

5 Answers 221 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 28 Nov 2017, 05:34 PM

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

5 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 29 Nov 2017, 02:33 PM
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.
0
Alex
Top achievements
Rank 1
answered on 29 Nov 2017, 04:15 PM

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

 

 

0
Alex
Top achievements
Rank 1
answered on 29 Nov 2017, 04:45 PM

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

var scheduler = $scope.myScheduler.data();
console.log(scheduler);
0
Accepted
Plamen
Telerik team
answered on 01 Dec 2017, 01:31 PM
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.
0
Alex
Top achievements
Rank 1
answered on 01 Dec 2017, 04:25 PM
Thanks Plamen, it works perfect.
Tags
Scheduler
Asked by
Alex
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Alex
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or