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.refresh()">Refresh Data</button>
|
||||
<button onclick="switchToTreeView()" data-action="treeview">TreeView</button>
|
||||
<button onclick="appendRows()">Append Rows</button>
|
||||
<label>
|
||||
<input type="checkbox" id="input-large-data" />
|
||||
<span>Large Data</span>
|
||||
@ -278,6 +279,15 @@
|
||||
console.log(e)
|
||||
}
|
||||
};
|
||||
|
||||
function appendRows() {
|
||||
datatable.appendRows(
|
||||
[
|
||||
["Garrett", "Accountant", "Tokyo", 8422, "2011/07/25", 170],
|
||||
["Winters", "Accountant", "Tokyo", 8422, "2011/07/25", 123]
|
||||
]
|
||||
)
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
||||
@ -29,7 +29,8 @@ export default class DataManager {
|
||||
this.rows = [];
|
||||
|
||||
this.prepareColumns();
|
||||
this.prepareRows();
|
||||
this.validateData(this.data);
|
||||
this.rows = this.prepareRows(this.data);
|
||||
this.prepareTreeRows();
|
||||
this.prepareRowView();
|
||||
this.prepareNumericColumns();
|
||||
@ -141,10 +142,8 @@ export default class DataManager {
|
||||
});
|
||||
}
|
||||
|
||||
prepareRows() {
|
||||
this.validateData(this.data);
|
||||
|
||||
this.rows = this.data.map((d, i) => {
|
||||
prepareRows(data) {
|
||||
return data.map((d, i) => {
|
||||
const index = this._getNextRowCount();
|
||||
|
||||
let row = [];
|
||||
@ -243,8 +242,9 @@ export default class DataManager {
|
||||
|
||||
appendRows(rows) {
|
||||
this.validateData(rows);
|
||||
|
||||
this.rows.push(...this.prepareRows(rows));
|
||||
this.rows = this.rows.concat(this.prepareRows(rows));
|
||||
this.prepareTreeRows();
|
||||
this.prepareRowView();
|
||||
}
|
||||
|
||||
sortRows(colIndex, sortOrder = 'none') {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user