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

Angular Kendo UI how to set DataSource's event handlers through k-on Attribute

3 Answers 212 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Velumani
Top achievements
Rank 1
Velumani asked on 10 Aug 2017, 05:53 AM

Hi, 

How to set DataSource's handlers through k-on Attribute? Is there a way to achieve it like this:

k-on-request-start="onRequestStart($kendoEvent)"

k-on-request-end="onRequestEnd($kendoEvent)"

3 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 11 Aug 2017, 10:13 AM
Hi,

Edited:
It is not possible to use k-on attributes for declaring Kendo UI DataSource events, because unlike the widgets, which may be declared with markup, the datasource is declared in script only. Thus, its events may be set as follows:

angular.module("KendoDemos", [ "kendo.directives" ])
      .controller("MyCtrl", function($scope){
          $scope.productsDataSource = {
            type: "odata",
            serverFiltering: true,
            transport: {
                read: {
                    url: "https://demos.telerik.com/kendo-ui/service/Northwind.svc/Products",
                }
            },
            requestEnd: function() {
            }
        };


Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Velumani
Top achievements
Rank 1
answered on 11 Aug 2017, 10:43 AM

Thanks for the immediate response.

as like k-on-change="onChange(data)"

$scope.onChange = function(data){
    $scope.selected = data;
  };

Can we achieve it like this ?

  <div kendo-grid
         k-data-source="gridData"
         k-columns="gridColumns"
         k-on-request-start="onRequestStart($kendoEvent)"

$scope.onRequestStart= function(e){
    ...
  };

 

0
Accepted
Dimitar
Telerik team
answered on 11 Aug 2017, 11:07 AM
Hi,

I am afraid this is not possible for the datasource. My initial response was wrong, as it targets widgets with markup initialization, which is not the case with DataSource. So I updated the response to avoid confusion. Please check the updated response above.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Data Source
Asked by
Velumani
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Velumani
Top achievements
Rank 1
Share this question
or