I'm trying to supplement a kendo component by creating my own directive that I can add as an attribute to the kendo directive. In my situation I'd like to add my own directive to the kendo-grid element I'm using. The hard part is finding a proper way to get a reference to the grid in that directive or its element. All I'm trying to do is add a click handler to the header of the expand collapse detail column so that I can implement a "expand all" feature.
The most straight forward way would be if I could hook into some event from the $element that angular passes into my directive which fires once the grid is rendered.
Hopefully this snippet explains what I'm trying to do:
angular.module('mod')
.directive('kendoExpandAll', kendoExpandAll);
function kendoExpandAll() {
return {
scope: {},
controller: KendoExpandAll,
controllerAs: 'KendoExpandAll',
bindToController: true,
};
}
KendoExpandAll.$inject = ['$element'];
function KendoExpandAll($element) {
// somehow get an instance of the kendo grid that this directive has been added to
var expandHeaderJqElement = kendoGridInstance.thead.find('.k-hierarchy-cell.k-header');
expandHeaderJqElement.on('click', toggleExpandAll.bind(kendoGridInstance));
}
I'm trying to supplement a kendo component by creating my own directive that I can add as an attribute to the kendo directive. In my situation I'd like to add my own directive to the kendo-grid element I'm using. The hard part is finding a proper way to get a reference to the grid in that directive or its element. All I'm trying to do is add a click handler to the header of the expand collapse detail column so that I can implement a "expand all" feature.
The most straight forward way would be if I could hook into some event from the $element that angular passes into my directive which fires once the grid is rendered.
Hopefully this snippet explains what I'm trying to do: