api-platform / admin

A beautiful and fully-featured administration interface builder for hypermedia APIs
https://api-platform.com/docs/admin/
MIT License
480 stars 130 forks source link

compound order by #510

Closed PawelSuwinski closed 5 months ago

PawelSuwinski commented 11 months ago

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.

soyuka commented 10 months ago

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

PawelSuwinski commented 10 months ago

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 commented 6 months ago

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 commented 5 months ago

Thank you!