this follows directly on from this question (with an additional question hence I thought should be a new post?)
The link above shows how to get a grid instance in Angular (thanks to Lars)
So, following on from this last example, I now have added the following directive..
<body>
<div data-ng-app="app">
<div data-ng-controller="Grid as vm">
<div id='aa'>
<div pckendo id='bb' kendo-grid='grid'
k-options="vm.options"></div>
</div>
</div>
</div>
</body>
and in the .js added
angular
.module("app", ["kendo.directives"])
.controller("Grid", Grid)
.directive('pckendo', PCKendo);
....
function PCKendo() {
function link(scope, element, attrs) {
var instance = element;
var vm = scope.vm;
vm.msg = "";
var grid = scope.grid;
}
return {
link: link
}
See here for full example.
Rather than getting the instance in the controller, I would like to get it via a directive (as from what I understand this is a better place to do event handling etc)
I have tried a few things in there, but haven't been able to get the grid instance, so any further help here would be great.
Thanks in advance!
Basically you do the same thing; you need to wait for the
kendoRendered
event, e.g. like this (note that this example may not conform to angular best practices (re isolate scope etc.)):(demo)