4
我的團隊一直在努力如下:我們如何向ng-grid添加一行然後選擇該行?
$scope.addTest = function() {
var TestRow = {
"name": "xx",
"description": "xx",
"subjectId": 15
};
$scope.gridOptions.selectAll()
var testRowLength = $scope.gridData.push(TestRow);
$scope.gridOptions.selectItem(testRowLength - 1, true);
}
但是最後選擇信息不正確地做一個選擇。因此,我們嘗試了以下內容:
$scope.$apply(function() {
$scope.gridData.push(TestRow);
$scope.gridOptions.selectItem(testRowLength - 1, true);
});
現在,我們得到一個錯誤消息說:
Error: $apply already in progress
這個問題是張貼有關下一代網博客的問題,但它只是剛剛發表,我們需要儘快爲此提供幫助。我希望有人可以給我們提供建議,如何我們可以
嗨,在testRowLength你有得到最後一行添加不是網格的長度,所以可能會更好,像var var lastRow = $ scope.gridData.push(TestRow); var gridLength = $ scope.gridData.length; $ scope.gridOptions.selectItem(gridLength - 1,true); 嘗試使用 var index = this.row.rowIndex; $ scope.gridOptions.selectItem(index,true); – Whisher 2013-09-08 18:54:41