角度ui网格线选择不起作用 [英] Angular ui-grid line selection is not working
问题描述
我正在尝试使用Angular ui-grid选择第一条重装线,但是它不起作用.
这是带有示例的 plunker 的示例.
从服务器渲染数据后,我可以使用超时来做到这一点,但不能使用$scope.gridApi.grid.modifyRows($scope.gridOptions.data);
$scope.gridApi.selection.selectRow($scope.gridOptions.data[0]);
,如其他示例所示.
您能帮我修复它吗?
I'm trying to select the first rendred line using Angular ui-grid but it's not working.
Here is a plunker with the example.
I was able to do it using timeout after rendering data from the server but not using $scope.gridApi.grid.modifyRows($scope.gridOptions.data);
$scope.gridApi.selection.selectRow($scope.gridOptions.data[0]);
as shown in different example.
would you please help me fixing it?
推荐答案
如果通过异步调用加载数据,则可以选择回调中的行,可以使用$ scope.gridApi,因为将其保存在onRegisterApi中功能.
If the data is getting loaded by an async call you can select the rows in the callback, you can use $scope.gridApi since you saved it in the onRegisterApi function.
请找到朋克车
$http.get('https://cdn.rawgit.com/angular-ui/ui-grid.info/gh-pages/data/500_complex.json')
.success(function (data) {
$scope.gridOptions.data = data;
$scope.gridApi.grid.modifyRows($scope.gridOptions.data);
$scope.gridApi.selection.selectRow($scope.gridOptions.data[0]);
});
这篇关于角度ui网格线选择不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!