Angularjs UI Grid gridApi.selection.getSelectedRows()未按选择的顺序提供行
我使用“全选”按钮在ui网格中实现以下用例(已实现分页):Angularjs UI Grid gridApi.selection.getSelectedRows()未按选择的顺序提供行,angularjs,gridview,datagridview,angular-ui-grid,ui-grid,Angularjs,Gridview,Datagridview,Angular Ui Grid,Ui Grid,我使用“全选”按钮在ui网格中实现以下用例(已实现分页): 加载第一页的初始50条记录,列为name、id、age 单击“全选”以使用以下代码选择渲染的所有行: 选择代码:gridApi.Selection.selectRow(gridOptions.data[rowIndex]) 获取所选代码:gridApi.selection.getSelectedRows() 直到这里一切都很顺利 现在,单击ID列以对ID应用排序 单击“全选”以使用以下代码选择渲染的所有行: gridApi.select
vm.selectAll = function selectAll() {
var rowIndex;
vm.gridApi.grid.modifyRows(vm.gridOptions.data);
for (rowIndex = 0; rowIndex < MAX_SELECTION_ALLOWED; rowIndex++) {
if(vm.isUISortingApplied){
//vm.gridApi.selection.selectRow(vm.gridApi.core.getVisibleRows()[rowIndex].entity);
vm.gridApi.selection.selectRowByVisibleIndex(rowIndex);
}else{
vm.gridApi.selection.selectRow(vm.gridOptions.data[rowIndex]);
}
}
};
vm.selectAll=函数selectAll(){
var指数;
vm.gridApi.grid.modifyRows(vm.gridOptions.data);
对于(rowIndex=0;rowIndex
因此,在一行中,我应该询问ui grid提供了什么功能来选择并在应用排序后获取所选行?
提前谢谢 通过使用gridApi.core.getVisibleRows()函数获得问题的解决方案,该函数在排序后按正确的顺序提供行。我建议在实现任何排序的情况下,通过选择此函数来使用行选择。谢谢 我必须选择前50行进行排序/不进行排序的示例:
vm.selectMax = function selectMax() {
var rowIndex;
vm.gridApi.grid.modifyRows(vm.gridOptions.data);
for (rowIndex = 0; rowIndex < MAX_SELECTION_ALLOWED; rowIndex++) {
vm.gridApi.selection.selectRow(vm.gridApi.core.getVisibleRows()[rowIndex].entity);
}
};
vm.selectMax=函数selectMax(){
var指数;
vm.gridApi.grid.modifyRows(vm.gridOptions.data);
对于(rowIndex=0;rowIndex