mirror of
https://github.com/nasa/openmct.git
synced 2024-12-23 23:12:23 +00:00
Fix table sorting in descending order (#7863)
When adding sorted arrays to the beginning, make sure to insert them in the same order and not accidentally reverse them while inserting. Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: John Hill <john.c.hill@nasa.gov>
This commit is contained in:
parent
47f0b66c7e
commit
83e4a124e2
@ -150,13 +150,13 @@ export default class TableRowCollection extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
insertOrUpdateRows(rowsToAdd, addToBeginning) {
|
insertOrUpdateRows(rowsToAdd, addToBeginning) {
|
||||||
rowsToAdd.forEach((row) => {
|
rowsToAdd.forEach((row, addRowsIndex) => {
|
||||||
const index = this.getInPlaceUpdateIndex(row);
|
const index = this.getInPlaceUpdateIndex(row);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
this.updateRowInPlace(row, index);
|
this.updateRowInPlace(row, index);
|
||||||
} else {
|
} else {
|
||||||
if (addToBeginning) {
|
if (addToBeginning) {
|
||||||
this.rows.unshift(row);
|
this.rows.splice(addRowsIndex, 0, row);
|
||||||
} else {
|
} else {
|
||||||
this.rows.push(row);
|
this.rows.push(row);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user