用户单击行树或表插件时如何更改数据(无法获取数据中的行索引)?

时间:2019-01-18 03:14:45

标签: javascript gantt-chart angular-gantt

我在项目中使用https://github.com/angular-gantt/angular-gantt。 当用户通过调用表单弹出窗口单击侧面内容树或表插件中的行或更改数据内联树或表插件时,我尝试编写用于更改数据的js代码。为此,我需要获取用户单击的行索引。

参数(directiveName,indirectScope,元素,iAttrs,控制器)在$ scope.data [index]中没有有关索引的信息。

如何在下面的代码中获取var索引?

谢谢!

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
              
            });
          //   }
        });
        }
        }

0 个答案:

没有答案