Skip to content

Commit

Permalink
Merge pull request #200 from helsenorge/rubenr/bugfix-table-hn2-sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
ruberino authored Jul 1, 2024
2 parents cf27c9a + d579158 commit d931fd8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 15.0.8

---

- Bugfix:
- fix a bug in the table-hn2. Not being able to sort on the first column in the table

## 15.0.7

---
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@helsenorge/refero",
"version": "15.0.7",
"version": "15.0.8",
"engines": {
"node": "^18.0.0",
"npm": ">=9.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const TableHn2 = ({ tableCodesCoding, items, questionnaireResponse }: Props): JS
}, [sortDir, items, questionnaireResponse]);
return rows.length ? (
<HnTable className="page_refero__table_hn2">
<TableHeadHn2 sortable={!!sortIndex} setSortDir={setSortDir} sortDir={sortDir} tableCodesCoding={tableCodesCoding} />
<TableHeadHn2 sortable={sortIndex !== undefined} setSortDir={setSortDir} sortDir={sortDir} tableCodesCoding={tableCodesCoding} />
<TableBody className='className="page_refero__table_hn2__body'>
{rows.map((item, index) => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const getTableHN2bodyObject = (
const structure = createTableStructure(items, itemsToShow);
const tableWithRemovedEmptyRows = structure.filter(row => row.columns.some(column => column.text !== ''));

if (!!sortColumnIndex && !!sortOrder) {
if (sortColumnIndex !== undefined && !!sortOrder) {
return sortTableRows(tableWithRemovedEmptyRows, sortColumnIndex, sortOrder);
}
return tableWithRemovedEmptyRows;
Expand Down

0 comments on commit d931fd8

Please sign in to comment.