[BUG] getSubmissions sort filter has no effect
Environment
Please provide as many details as you can:
- Hosting type
- [ ] Form.io
- [x] Local deployment
- Version: 4.3.0
- Formio.js version: 4.14.2
- Frontend framework: 16.8.2
- Browser: chrome
- Browser version: 100.x
Steps to Reproduce
- Use getSubmissions (name, page filter)
- As filter use { sort: '-data.newsdatetime' }
- Submissions are not sorted
Expected behavior
To be sorted in a descending order
Observed behavior
Example
If possible, please provide a screenshot, live example (via JSFiddle or similar), and/or example code to help demonstrate the issue.
For code or form JSON, please enclose in a code block:
const filter = {
sort: '-data.newsdatetime',
}
getSubmissions('news', 1, filter, '', (err, result) => {
if (err === null) {
console.log('Results=', result, 'Filter=', filter);
}
}),
It seems that the offending code export const getSubmissions = .... at src\modules\submissions\actions.js ignores any sub-calling getSubmissions() sorting parameters if the initial internal state is missing of this attribute. Why?
const {
limit,
query,
select,
sort,
} = selectRoot(name, getState());
if (sort) {
requestParams.sort = sort;
}
else {
delete requestParams.sort;
}
formio.loadSubmissions({params: requestParams})
We're currently addressing a backlog of GitHub issues. Closing this thread as it is outdated. Please re-open if it is still relevant. Thank you for your contribution!