简体   繁体   English

如何从事件参数获取剑道角网格行索引

[英]how do I get kendo angular grid row index from event parameter(e)

$scope.deleteClick = function(e){
    e.preventDefault();
    var datasource = $scope.mygrid.datasource;
    var index = $(e.target).closest("tr")[0].rowIndex;
    datasource.remove(datasource.at(index -1));
}

At this code, you will see that I did DOM manipulation, because I did not get row index from parameter e . 在这段代码中,您将看到我进行了DOM操作,因为我没有从参数e获得行索引。 Please help me to get the row index. 请帮助我获取行索引。

我可以建议您使用Grid的removeRow方法并仅传递TR元素(无法避免访问TR元素)。

grid.removeRow($(e.target).closest('tr'))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM