Is there a way to have a date range search in the interface, that would generate a request to the REST server asking for elements that are between two dates?
Asked
Active
Viewed 427 times
1 Answers
2
It really depends on the supported filters on the API side. For instance, ng-admin-demo allows to filter visitors who visited the site since a particular date (http://marmelab.com/ng-admin-demo/#/customers/list?search=%7B%22last_seen_gte%22:%222015-12-13T23:00:00.000Z%22,%22has_ordered%22:%22true%22%7D). How does it do that? Simply by naming the filter field last_seen_gte
. This _gte
suffix is transformed by the API (or, in the case of ng-admin-demo, by FakeRest) into a <=
condition.
So it's not a matter of ng-admin supporting it or not, it's a matter of your API supporting it or not.

François Zaninotto
- 7,068
- 2
- 35
- 56
-
I didn't think about doing it this way, but PostgREST doesn't allow manipulation of the field. So if I set a filter field as `last_seen_gte` (intercepted by `RestangularProvider.addFullRequestInterceptor()` to have `gte.` instead of `eq.`), it will request a field named `last_seen_gte` and not `last_seen`. I can't see a way to change the field before it is sent, as it's stored in a table (`params._filters`).If I set it to `last_see`, I will lose the content of the value that was already there (especially because I also want a `last_see_lte` which will also erase the content of `last_see`) :-( – Luc Stepniewski Feb 12 '16 at 06:28