Skip to content

Commit 0f66e85

Browse files
committed
Actually fix tables
1 parent b3d388a commit 0f66e85

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

frontend/javascript/modules/table.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,28 @@ export default class Table {
77
this.table = table;
88

99
// Set options based on data attributes
10-
this.paginated = !(this.table.dataset.paginated === 'false');
1110
this.sortColumn = (_.isNil(this.table.dataset.sortColumn) ||
1211
_.isNaN(this.table.dataset.sortColumn)) ?
1312
1 : this.table.dataset.sortColumn;
1413
this.sortOrder = this.table.dataset.sortOrder === "asc" ? "asc" : "desc";
15-
this.lengthChangable = this.table.dataset.lengthChangable === 'true';
14+
15+
this.options = {
16+
lengthChange: this.table.dataset.lengthChangable === 'true',
17+
info: false,
18+
paging: !(this.table.dataset.paginated === 'false'),
19+
pagingType: "numbers"
20+
};
1621

1722
// Just remove the search input from the DOM instead of disabling it
18-
this.domOptions = "lrtip";
19-
if (this.table.dataset.searchable === 'true') {
20-
this.domOptions = "lfrtip";
23+
if (this.table.dataset.searchable !== 'true') {
24+
this.options.dom = "lrtip";
2125
}
2226

2327
this.render();
2428
}
2529

2630
render() {
27-
this.table = $(this.table).DataTable({ // eslint-disable-line new-cap
28-
// dom: this.domOptions,
29-
lengthChange: this.lengthChangable,
30-
info: false,
31-
paging: this.paginated,
32-
pagingType: "numbers"
33-
})
31+
this.table = $(this.table).DataTable(this.options) // eslint-disable-line new-cap
3432
.order([this.sortColumn, this.sortOrder])
3533
.draw();
3634
}

0 commit comments

Comments
 (0)