Skip to content
Snippets Groups Projects
Commit e4b5bd4c authored by Neuber, Eugen Ramon's avatar Neuber, Eugen Ramon :speech_balloon: Committed by Reiter, Christoph
Browse files

Update table columns only on first page load

parent dd67b53b
No related branches found
No related tags found
No related merge requests found
...@@ -159,16 +159,19 @@ class DataTableView extends LitElement { ...@@ -159,16 +159,19 @@ class DataTableView extends LitElement {
} }
} }
update_datatable(columns, rows) { update_datatable(columns, rows, is_first_page) {
//console.log('rows = ' + rows);
const that = this; const that = this;
if (this.table) { if (this.table) {
columns.forEach(function (item, index) { // set column visibility/titles on first page load only
let i = that.display_columns.indexOf(item.title); if (is_first_page) {
// console.log('item = {' + item.title + ', ' + item.visible + '} i = ' + i); columns.forEach(function (item) { //, index) {
that.table.columns([i]).visible(item.visible == true); let i = that.display_columns.indexOf(item.title);
// TODO that.table.columns([index]).title = item.title; that.table.columns([i]).visible(item.visible === true);
}); // if column order has changed, update column title also
let t = that.table.columns([i]).header();
$(t).html(item.title);
});
}
rows.forEach(row => this.table.row.add(row)); rows.forEach(row => this.table.row.add(row));
// now ready to draw // now ready to draw
this.table.draw(); this.table.draw();
...@@ -208,14 +211,15 @@ class DataTableView extends LitElement { ...@@ -208,14 +211,15 @@ class DataTableView extends LitElement {
} }
} }
that.update_datatable(columns, rows); that.update_datatable(columns, rows, page === 1);
if (!that.wait_until_all_loaded) if (!that.wait_until_all_loaded)
that.is_loading = false; that.is_loading = false;
return items.length; return rows.length;
}); });
} }
async call_loader(page) { async call_loader(page) {
return await this.loader(page); return await this.loader(page);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment