我的问题是这个问题的延伸
Getting select rows from ng-grid?
笨蛋 - http://plnkr.co/edit/DiDitL?p=preview
我需要在页面加载时选择一行并且我需要避免监听“ngGridEventData”
调用 $scope.gridOptions.selectRow(2, true);由于尚未加载网格,因此在 Controller 主体中失败。
避免监听 ngGridEventData 是因为我需要 Controller 监听之前触发的事件,并基于该事件选择 nggrid 行。
有什么想法吗?
最佳答案
将 $timeout
添加到您的 Controller 并执行此操作:
$timeout(function() {
$scope.gridOptions.selectRow(2, true);
});
关于javascript - Angular ngGrid 在页面加载时选择行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18504761/