how can i raise my event in my directive's kendogrid toolbar template?

1 posts, 0 answers
  1. Alireza
    Alireza avatar
    2 posts
    Member since:
    Dec 2011

    Posted 16 Feb 2014 Link to this post


    I am using angularJS and kendoUI and create my own directive using by kendo. in grid directive I use kendogrid that it have a toolbar. i fill toolbar with html template but it cant trigger my function with ng-click.
     here my sample code

    directive.js
    app.directive('fonixGrid', [function () {
    return {
                restrict: 'EA',
                replace: true,
                transclude: true,
                scope: {
                             gridtoolbar :"="
                            },
                 template: '<div id="kendogrid" ></div>',
                 link: function (scope, element, attrs) {
                 element.kendoGrid({
                 toolbar: '<a ng-click=gridtoolbar.click()></a>',
                 editable: attrs.editable ? attrs.editable : true,
                 scrollable: attrs.scrollable ? attrs.scrollable : true,
                 sortable: attrs.sortable ? attrs.sortable : true,
                  };
    }]);


    Contoller.js
       app.register.controller('userViewModelController', ["$scope",
               , function ($scope) {
               var onclick = function () {
                              console.log('clicked');
                };
              $scope.mytoolbar = { click: onclick };
    }]);


    index.html
    <html>
          <div>
              <div>
                    <fonix:grid gridtoolbar ="mytoolbar " />
             </div>
         </div>
    </html>
Back to Top