I m trying to work with celltemplate. But click event did not work.
$scope.format = function(val){
return val.replace(/\//g, "");
};
var executionColumns = {
data: [],
enableSorting: true,
paginationPageSizes: [25, 50, 75],
paginationPageSize: 25,
enableColumnMenu: true,
enableFiltering: true,
columnDefs: [
{ field: 'StartDate', cellTemplate: '<button ng-click="format (row.entity)">log</button>' },
{ field: 'Status' },
]
};
So what should I do? What is the wrong?
In case you are using
.component
inside of which you render aui-grid
and your method is defined as:this.handleClick = function(){...}
It will be available to you in
cellTemplate
viacellTemplate: '<button ng-click="grid.appScope.$ctrl.handleClick()">log</button>' }
Use
<button ng-click="grid.appScope.format (row.entity)">log</button>
it is working for me now!
It works for me like the 2nd code
or move your format function to an externalscope defined as
and then use the template like