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

Support for sorting and filtering #1

Open
dgrudenic opened this issue Apr 19, 2019 · 1 comment
Open

Support for sorting and filtering #1

dgrudenic opened this issue Apr 19, 2019 · 1 comment

Comments

@dgrudenic
Copy link

I was playing with GET_LIST. Works great but I noticed that sort and filter are not supported. Do you plan to add those in future?

GET_LIST GET http://my.api.url/posts?sort=['title','ASC']&range=[0, 24]&filter={title:'bar'}

Thanks

@IgorNB
Copy link

IgorNB commented May 26, 2019

To add:

  1. Sort we only need little changes in dataProvider and in @RestController

  2. Filtering for any field is much more complicated, because spring controllers and repositories does not have out-of-the-box functionality to do this. Few variants can be found here: https://www.baeldung.com/spring-rest-api-query-search-language-tutorial

Variant with QueryDSL (https://www.baeldung.com/rest-api-search-language-spring-data-querydsl) was used for integration with react-admin in my sample app:
https://github.com/IgorNB/Libby .

Filtering and sorting in this sample work fine: https://www.youtube.com/watch?v=tGOQ4pxfIx8&feature=youtu.be

Fixed dataProvider: https://github.com/IgorNB/Libby/blob/master/src/main/webapp/app/dataProvider/index.js

Fixed restController findAll method: https://github.com/IgorNB/Libby/blob/master/src/main/java/com/lig/libby/controller/adapter/userui/LangPublicController.java

Fixed repository: https://github.com/IgorNB/Libby/blob/master/src/main/java/com/lig/libby/repository/LangRepository.java

This examples are rather complicated because of using DTO's , mapStruct and Spring Security. I can create simplified example - let me know if you are intrested in

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

No branches or pull requests

2 participants