I have utilized a tree grid plugin from the following link: https://github.com/khan4019/tree-grid-directive
and I made some customizations to its template:
.directive('treeGrid', [
'$timeout', function($timeout) {
return {
restrict: 'E',
template:
"<div class=\"table-responsive\">\
<table id=\"policies\" class=\"table table-striped\">\
<colgroup>\
<col width=\"10%\" />\
<col width=\"70%\" />\
<col width=\"1%\" />\
<col width=\"1%\" />\
</colgroup>\
<thead>\
<tr>\
<th>Category</th>\
<th>Content</th>\
<th></th>\
<th></th>\
<th></th>\
</tr>\
</thead>\
<tbody>\
<tr ng-repeat=\"row in tree_rows | filter:{visible:true} track by row.branch.uid\" ng-class=\"'level-' + {{ row.level }} + (row.branch.selected ? ' active':'')\">\
<td class=\"text-primary\"><a ng-click=\"user_clicks_branch(row.branch)\"><i ng-class=\"row.tree_icon\"ng-click=\"row.branch.expanded = !row.branch.expanded\"class=\"indented tree-icon\"></i></a>\
<span class=\"indented tree-label\" ng-click=\"user_clicks_branch(row.branch)\"> {{row.branch[expandingProperty]}}</span></td>\
<td ng-bind-html=\"row.branch[colDefinitions[2].field]\"></td>\
<td> <a href=\"javascript:void(0)\" ng-click=\"editContent(row.branch)\" data-toggle=\"modal\" data-target=\"#new-content\" class=\"action\"><i class=\"glyphicon glyphicon-edit\"></i></a> </td>\
<td> <a ng-click=\"deleteContent(row.branch.Id)\" class=\"action\"><i class=\"glyphicon glyphicon-remove-circle\"></i></a> </td>\
</tr>\
</tbody>\
</table>\
</div>",
replace: true,
scope: {
treeData: '=',
colDefs:'=',
expandOn:'=',
onSelect: '&',
deleteContent: '&',
editContent: '&',
initialSelection: '@',
treeControl: '='
},
In addition, I have defined the following controller:
.controller('ContentCtrl', ['$http', '$scope', '$location', '$localStorage', 'authService', 'settings', function ($http, $scope, $location, $localStorage, authService, settings) {
$scope.deleteContent = function(){
console.log("delete");
};
}]);
Furthermore, I have included this view:
<tree-grid tree-data="policies"></tree-grid>
However, when I click on the delete link, nothing happens. It seems like it is not triggering the controller scope functions.
What could be causing this issue? Did I make a mistake somewhere?
I am aware that implementing the functions directly in the directive would be a workaround but not an ideal solution. How can I resolve this issue effectively?