Merge pull request #1973 from OHIF/feat/ohif-318
OHIF-318: When the default sort "descending by study date" is applied, the UI should reflects the applied sorting
This commit is contained in:
commit
4af0933406
@ -45,6 +45,12 @@ function WorkList({ history, data: studies, isLoadingData, dataSource }) {
|
|||||||
const debouncedFilterValues = useDebounce(filterValues, 200);
|
const debouncedFilterValues = useDebounce(filterValues, 200);
|
||||||
const { resultsPerPage, pageNumber, sortBy, sortDirection } = filterValues;
|
const { resultsPerPage, pageNumber, sortBy, sortDirection } = filterValues;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The default sort value keep the filters synchronized with runtime conditional sorting
|
||||||
|
* Only applied if no other sorting is specified and there are less than 101 studies
|
||||||
|
*/
|
||||||
|
let defaultSortValues = {};
|
||||||
|
|
||||||
const sortedStudies = studies
|
const sortedStudies = studies
|
||||||
// TOOD: Move sort to DataSourceWrapper?
|
// TOOD: Move sort to DataSourceWrapper?
|
||||||
// TODO: MOTIVATION, this is triggered on every render, even if list/sort does not change
|
// TODO: MOTIVATION, this is triggered on every render, even if list/sort does not change
|
||||||
@ -54,7 +60,10 @@ function WorkList({ history, data: studies, isLoadingData, dataSource }) {
|
|||||||
|
|
||||||
if (noSortApplied && studies.length < 101) {
|
if (noSortApplied && studies.length < 101) {
|
||||||
const ascendingSortModifier = -1;
|
const ascendingSortModifier = -1;
|
||||||
|
defaultSortValues = {
|
||||||
|
sortBy: 'studyDate',
|
||||||
|
sortDirection: 'ascending',
|
||||||
|
};
|
||||||
return _sortStringDates(s1, s2, ascendingSortModifier);
|
return _sortStringDates(s1, s2, ascendingSortModifier);
|
||||||
} else if (noSortApplied) {
|
} else if (noSortApplied) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -353,7 +362,7 @@ function WorkList({ history, data: studies, isLoadingData, dataSource }) {
|
|||||||
<StudyListFilter
|
<StudyListFilter
|
||||||
numOfStudies={numOfStudies}
|
numOfStudies={numOfStudies}
|
||||||
filtersMeta={filtersMeta}
|
filtersMeta={filtersMeta}
|
||||||
filterValues={filterValues}
|
filterValues={{ ...filterValues, ...defaultSortValues }}
|
||||||
onChange={setFilterValues}
|
onChange={setFilterValues}
|
||||||
clearFilters={() => setFilterValues(defaultFilterValues)}
|
clearFilters={() => setFilterValues(defaultFilterValues)}
|
||||||
isFiltering={isFiltering(filterValues, defaultFilterValues)}
|
isFiltering={isFiltering(filterValues, defaultFilterValues)}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user