You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorting is only working when clicking on the header table of timestamp. This because query parameters are added to the url.
When investigating this problem i found that oneToManyHandler (@adminjs/relations/lib/actions/one-to-many/one-to-many.handler.js) is defaulting its query parameter direction to asc.
export const oneToManyHandler = async (a, b, c = {}, d) => {
const {
relation: e,
targetResource: f,
} = b, {
sortBy: g,
direction: h = 'asc',
filters: i = {},
perPage: j = d._admin.options.settings?.defaultPerPage || 10,
page: k = 1,
} = c;
This causes the sortSetter (adminjs/src/backend/services/sort-setter/sort-setter) to always default back to asc in code. const computedDirection = direction || options.direction || DEFAULT_DIRECTION
🚀🚀🚀 Proposed solution: remove default of direction in oneToManyHandler function.
Contact Details
No response
What happened?
Im trying to sort my oneToMany table on configured sort options.
Sorting is only working when clicking on the header table of timestamp. This because query parameters are added to the url.
When investigating this problem i found that
oneToManyHandler
(@adminjs/relations/lib/actions/one-to-many/one-to-many.handler.js) is defaulting its query parameterdirection
to asc.This causes the
sortSetter
(adminjs/src/backend/services/sort-setter/sort-setter) to always default back to asc in code.const computedDirection = direction || options.direction || DEFAULT_DIRECTION
🚀🚀🚀
Proposed solution: remove default of
direction
inoneToManyHandler
function.Bug prevalence
Visting overview page with relations
AdminJS dependencies version
What browsers do you see the problem on?
No response
Relevant log output
No response
Relevant code that's giving you issues
No response
The text was updated successfully, but these errors were encountered: