switchColumn, deleteColumn bug fix

This commit is contained in:
Faris Ansari 2018-02-28 11:45:35 +05:30
parent b2d26e987b
commit bf6b00d78f

View File

@ -214,7 +214,7 @@ export default class DataManager {
appendRows(rows) { appendRows(rows) {
this.validateData(rows); this.validateData(rows);
this.rows = this.rows.concat(this.prepareRows(rows)); this.rows.push(...this.prepareRows(rows));
} }
sortRows(colIndex, sortOrder = 'none') { sortRows(colIndex, sortOrder = 'none') {
@ -303,7 +303,7 @@ export default class DataManager {
this.columns[index2].colIndex = index2; this.columns[index2].colIndex = index2;
// update rows // update rows
this.rows = this.rows.map(row => { this.rows.forEach(row => {
const newCell1 = Object.assign({}, row[index1], { const newCell1 = Object.assign({}, row[index1], {
colIndex: index2 colIndex: index2
}); });
@ -311,15 +311,8 @@ export default class DataManager {
colIndex: index1 colIndex: index1
}); });
let newRow = row.map(cell => { row[index2] = newCell1;
// make object copy row[index1] = newCell2;
return Object.assign({}, cell);
});
newRow[index2] = newCell1;
newRow[index1] = newCell2;
return newRow;
}); });
} }
@ -335,12 +328,13 @@ export default class DataManager {
.map(map); .map(map);
// update rows // update rows
this.rows = this.rows.map(row => { this.rows.forEach(row => {
const newRow = row // remove cell
.filter(filter) row.splice(index, 1);
.map(map); // update colIndex
row.forEach((cell, i) => {
return newRow; cell.colIndex = i;
});
}); });
} }