fix: appendRows bug (#181)
Co-authored-by: ArunMuthuram <65416680+ArunMuthuram@users.noreply.github.com>
This commit is contained in:
parent
7ee8ca9304
commit
b21e547794
10
index.html
10
index.html
@ -21,6 +21,7 @@
|
|||||||
<button onclick="datatable.render()">Render Table</button>
|
<button onclick="datatable.render()">Render Table</button>
|
||||||
<button onclick="datatable.refresh()">Refresh Data</button>
|
<button onclick="datatable.refresh()">Refresh Data</button>
|
||||||
<button onclick="switchToTreeView()" data-action="treeview">TreeView</button>
|
<button onclick="switchToTreeView()" data-action="treeview">TreeView</button>
|
||||||
|
<button onclick="appendRows()">Append Rows</button>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" id="input-large-data" />
|
<input type="checkbox" id="input-large-data" />
|
||||||
<span>Large Data</span>
|
<span>Large Data</span>
|
||||||
@ -278,6 +279,15 @@
|
|||||||
console.log(e)
|
console.log(e)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function appendRows() {
|
||||||
|
datatable.appendRows(
|
||||||
|
[
|
||||||
|
["Garrett", "Accountant", "Tokyo", 8422, "2011/07/25", 170],
|
||||||
|
["Winters", "Accountant", "Tokyo", 8422, "2011/07/25", 123]
|
||||||
|
]
|
||||||
|
)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,8 @@ export default class DataManager {
|
|||||||
this.rows = [];
|
this.rows = [];
|
||||||
|
|
||||||
this.prepareColumns();
|
this.prepareColumns();
|
||||||
this.prepareRows();
|
this.validateData(this.data);
|
||||||
|
this.rows = this.prepareRows(this.data);
|
||||||
this.prepareTreeRows();
|
this.prepareTreeRows();
|
||||||
this.prepareRowView();
|
this.prepareRowView();
|
||||||
this.prepareNumericColumns();
|
this.prepareNumericColumns();
|
||||||
@ -141,10 +142,8 @@ export default class DataManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
prepareRows() {
|
prepareRows(data) {
|
||||||
this.validateData(this.data);
|
return data.map((d, i) => {
|
||||||
|
|
||||||
this.rows = this.data.map((d, i) => {
|
|
||||||
const index = this._getNextRowCount();
|
const index = this._getNextRowCount();
|
||||||
|
|
||||||
let row = [];
|
let row = [];
|
||||||
@ -243,8 +242,9 @@ 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));
|
this.prepareTreeRows();
|
||||||
|
this.prepareRowView();
|
||||||
}
|
}
|
||||||
|
|
||||||
sortRows(colIndex, sortOrder = 'none') {
|
sortRows(colIndex, sortOrder = 'none') {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user