I use https://github.com/angular-gantt/angular-gantt in my project. I try to write js code for change data when user click on row in side-content tree or table plugin by call form popup or change data inline tree or table plugin. For this purpose I need get row index which user clicked.
Parameters (directiveName, directiveScope, element, iAttrs, controller) have no info about index in $scope.data[index].
How to get var index in code below?
Thanks!
app.controller('Ctrl', ['$scope', function ($scope) {
$scope.registerApi = function (api) {
$scope.api = api;
api.directives.on.new($scope, function (directiveName, directiveScope, element, iAttrs, controller) {
// if (directiveName === 'ganttTaskContent') {
element.bind('click', function () {
console.log(directiveName, directiveScope, element, iAttrs, controller);
//How to get index variable value when user click on side row in table or tree plugin?
var index = 3;
$scope.data[index].tasks[0].from= new Date(2018, 9, 1, 8, 0, 0)
api.data.get()[index ].name="CHANGED";
api.columns.refresh(); // if no out of range
api.columns.generate(); // if out of range
});
// }
});
}
}