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

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

0 Answers 30 Views
Templates
This is a migrated thread and some comments may be shown as answers.
Alireza
Top achievements
Rank 1
Alireza asked on 16 Feb 2014, 06:42 AM

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>

No answers yet. Maybe you can help?

Tags
Templates
Asked by
Alireza
Top achievements
Rank 1
Share this question
or