Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compound order by #510

Merged
merged 2 commits into from
Mar 6, 2024
Merged

Conversation

PawelSuwinski
Copy link
Contributor

Hi,

Adds possibility to sort of compound filed, ex.

const UserList = (props) => (
<ListGuesser {...props}>
    // ...
    <FunctionField
       label={"Full name"}
       sortBy={"lastName, firstName"}
        render={(record) => `${record.lastName} ${record.firstName}`}
    />
</ListGuesser>
)

On column sort it gives queries with multiple order parameters:

https://localhost/users?order[lastName]=asc&order[firstName]=asc
https://localhttps://localhost/users?order[lastName]=desc&order[firstName]=desc

API Platform Core and SwaggerUI supports compound order (multiple order parameter), but Api Platform Admin doesn't allow to achieve it in some simple way. AFAIK ReactAdmin itself doesn't plan to support multicolumn order in data grids components but resolving of single column order based on sortBy porp it just a dataProvider job, and can be nicely extended to support such kind compound order.

@PawelSuwinski PawelSuwinski changed the title compund order by compound order by Oct 5, 2023
@soyuka
Copy link
Member

soyuka commented Oct 6, 2023

@PawelSuwinski
Copy link
Contributor Author

PawelSuwinski commented Oct 6, 2023

yes it supports that ? https://api-platform.com/docs/core/filters/#order-filter-sorting

Yes, backend does (Core) but it can't be used on the frontend side (excluding SwaggerUI) without extending API Platform Admin dataProvider. Correct me if I missed something.

@PawelSuwinski
Copy link
Contributor Author

Hi, what about merging it? I thinks it is quite useful, and covers gap between core and admin. We use it as a patch, but would be nice to have it official.

@dunglas dunglas merged commit 7280f61 into api-platform:main Mar 6, 2024
1 check passed
@dunglas
Copy link
Member

dunglas commented Mar 6, 2024

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants