Skip to content

Commit

Permalink
js: Fixes sort direction bug in RapidContext.Widget.Table widget
Browse files Browse the repository at this point in the history
Fixes bug introduced in 5ad2b64
  • Loading branch information
cederberg committed Jan 31, 2024
1 parent 8ea8b40 commit a4db5db
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/plugin/system/files/js/RapidContext_Widget_Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,9 +415,12 @@ RapidContext.Widget.Table.prototype.sortData = function (field, direction) {
this._selected = [];
for (let col of this.getChildNodes()) {
if (col.sort != "none") {
let match = col.field === field;
let sort = match ? direction || col.sort || "asc" : null;
col.setAttrs({ sort });
if (col.field === field) {
direction = direction || col.sort || "asc";
col.setAttrs({ sort: direction });
} else {
col.setAttrs({ sort: null });
}
}
}
this._rows.sort(RapidContext.Data.compare((o) => o[field]));
Expand Down

0 comments on commit a4db5db

Please sign in to comment.