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

[Solved] angularjs class diretive attach click event to Kedno UI grid

3 Answers 252 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Wit
Top achievements
Rank 1
Wit asked on 20 Feb 2015, 08:46 AM
I am trying to use class directive to attach click event to the next page button on the kendo grid.

Directive:

.directive('kPagerNav', function () {
return {
restrict: 'C',
controller: function ($scope, $element, $attrs, $location) {

if (typeof $scope.testFunc === "function") {
$element.click(function () {
$scope.testFunc();
});
}
}
}
})

Example
http://dojo.telerik.com/AKiqO

I have exactly the same directive working for a 'cancel changes' button , but I can't get next page click working.

3 Answers, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 24 Feb 2015, 08:13 AM
Hello WItek,

the issue you experience is most likely due to the CSS classes you target not being set at compile time, since the pager is updated asynchronously when the datasource fetches data.

You can verify if this is the case by attaching a debugger (or console.log call) in the directive controller function. 


Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Wit
Top achievements
Rank 1
answered on 24 Feb 2015, 09:21 AM
When  I am debugging I don't see that code to be called at all. Could you please suggest any way I could get it working ?

My goal is to display warning before user navigates to a next page if they have unsaved changes.
0
Petyo
Telerik team
answered on 25 Feb 2015, 04:48 PM
Hello Witek,

You may use the jQuery on method (with the respective selector) on a parent element to implement the same approach - this should handle the events accordingly. 

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Wit
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Wit
Top achievements
Rank 1
Share this question
or