react icon indicating copy to clipboard operation
react copied to clipboard

[BUG] getSubmissions sort filter has no effect

Open sdancer75 opened this issue 3 years ago • 1 comments

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

  1. Use getSubmissions (name, page filter)
  2. As filter use { sort: '-data.newsdatetime' }
  3. 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);
					}
				}),




sdancer75 avatar May 19 '22 09:05 sdancer75

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})

sdancer75 avatar May 20 '22 09:05 sdancer75

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!

jeriah-formio avatar Feb 14 '24 14:02 jeriah-formio