0
我目前正在使用Angular UI网格。编辑功能是实现的,它工作正常,除了一种情况,当我推动或从网格中删除任何行,然后我在行编辑过程中收到一个不正确的rowEntity对象。我相信很容易找到有经验的“问题”的原因。如何在Angular UI网格中获取正确的rowEntity?
假设网格最初包含两行。然后我在上面添加一行:$scope.gridOptions.data.unshift(//here is an object);
因此,网格中已经有3行。如果我尝试编辑第三行,则会从当前第二行而不是第三行获取rowEntity对象。
onRegisterApi: function(gridApi) {
$scope.gridApi = gridApi;
$scope.gridApi.rowEdit.on.saveRow($scope, function (rowEntity) {
//the rowEntity object is incorrect here if any row was either added or removed before the row that is under edit action now
}
}
我在做什么错?我误解或不知道什么?如果可以在on.saveRow()中传递渲染的索引行,我可以解决它。