请按照Asc / Desc对行进行排序后,为ag-grid行交换提供解决方案。我正在尝试在对网格列进行排序之后交换行,但是它不起作用(我已经在Asc / desc中对行索引进行了排序,并已经根据rowToDisplay行的迭代分配了RowIndex,并且能够看到rowIndex完美地分配了行)。如果我尝试在不进行排序的情况下执行行交换,那么它将正常工作而不会出现任何问题。
let RowToSwap = this.gridApi.getSelectedNodes()[0];
//Below will assign all the rows of Grid.
let allRows = this.allRowsofGrid(); //after sorting assigning the rowIndex
//Swapping row after Grid Sorting.
let PreRow = rows[RowToSwap.rowIndex - 1];
allRows[selectedRow.rowIndex] = UpRow;
allRows[selectedRow.rowIndex].SequenceNumber =
selectedRow.data.SequenceNumber
allRows[selectedRow.rowIndex - 1] = selectedRow.data;
allRows[selectedRow.rowIndex - 1].SequenceNumber =
selectedRow.data.SequenceNumber - 1;
this.gridApi.setRowData(allRows);// Not working after sorting.