ra-data-graphql-simple ReferenceManyField target Filter
See original GitHub issueWhat you were expecting: After making changes to the target parameter, I was finally able to remove another crutch. Thanks so much for this.
But there is one more problem. Here is the request sent in List:
const DistrictFilter = (props) => (
<Filter {...props}>
<ReferenceInput source="gasRegion.id" reference="GasRegion" allowEmpty emptyText="ra.message.no">
<AutocompleteInput optionText="name" />
</ReferenceInput>
</Filter>
);
==>
{operationName: "allGasDistricts",…}
operationName: "allGasDistricts"
query: "query allGasDistricts($page: Int, $perPage: Int, $sortField: String, $sortOrder: String, $filter: GasDistrictFilter) {↵ items: allGasDistricts(page: $page, perPage: $perPage, sortField: $sortField, sortOrder: $sortOrder, filter: $filter) {↵ id↵ name↵ description↵ createdAt↵ createdBy {↵ id↵ name↵ email↵ phone↵ __typename↵ }↵ updatedAt↵ deleted↵ gasRegion {↵ id↵ name↵ description↵ __typename↵ }↵ gasMeterPads {↵ id↵ name↵ description↵ __typename↵ }↵ reports {↵ id↵ name↵ description↵ type↵ template↵ __typename↵ }↵ tags {↵ id↵ name↵ description↵ color↵ resource↵ __typename↵ }↵ aisId↵ __typename↵ }↵ total: _allGasDistrictsMeta(page: $page, perPage: $perPage, filter: $filter) {↵ count↵ __typename↵ }↵}↵"
variables: {filter: {gasRegion: {id: "ck7omjmc40000pcurc9zc8usn"}}, page: 0, perPage: 10, sortField: "updatedAt",…}
filter: {gasRegion: {id: "ck7omjmc40000pcurc9zc8usn"}}
gasRegion: {id: "ck7omjmc40000pcurc9zc8usn"}
id: "ck7omjmc40000pcurc9zc8usn"
page: 0
perPage: 10
sortField: "updatedAt"
sortOrder: "DESC"
pay attention to the filter:
filter: {
gasRegion: {
id: "ck7omjmc40000pcurc9zc8usn"
}
}
This is exactly what i expect to see. This is working correctly.
What happened instead: However, if I want to get the same data with:
<ReferenceManyField
label="resources.GasRegion.fields.gasDistricts"
reference="GasDistrict"
target="gasRegion.id"
sort={{ field: 'updatedAt', order: 'DESC' }}
pagination={<Pagination />}
perPage={25}
>
<GasDistrictReferenceDatagrid />
</ReferenceManyField>
such a request is sent:
{operationName: "allGasDistricts",…}
operationName: "allGasDistricts"
query: "query allGasDistricts($page: Int, $perPage: Int, $sortField: String, $sortOrder: String, $filter: GasDistrictFilter) {↵ items: allGasDistricts(page: $page, perPage: $perPage, sortField: $sortField, sortOrder: $sortOrder, filter: $filter) {↵ id↵ name↵ description↵ createdAt↵ createdBy {↵ id↵ name↵ email↵ phone↵ __typename↵ }↵ updatedAt↵ deleted↵ gasRegion {↵ id↵ name↵ description↵ __typename↵ }↵ gasMeterPads {↵ id↵ name↵ description↵ __typename↵ }↵ reports {↵ id↵ name↵ description↵ type↵ template↵ __typename↵ }↵ tags {↵ id↵ name↵ description↵ color↵ resource↵ __typename↵ }↵ aisId↵ __typename↵ }↵ total: _allGasDistrictsMeta(page: $page, perPage: $perPage, filter: $filter) {↵ count↵ __typename↵ }↵}↵"
variables: {filter: {gasRegion.id: "ck7omjmc40000pcurc9zc8usn"}, page: 0, perPage: 25, sortField: "updatedAt",…}
filter: {gasRegion.id: "ck7omjmc40000pcurc9zc8usn"}
gasRegion.id: "ck7omjmc40000pcurc9zc8usn"
page: 0
perPage: 25
sortField: "updatedAt"
sortOrder: "DESC"
filter: {gasRegion.id: "ck7omjmc40000pcurc9zc8usn"}
This is a mistake.
I expected that in both cases the same filter will be generated.
Environment
- React-admin version: 3.4.2
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:9 (5 by maintainers)
Top Results From Across the Web
The ReferenceManyField Component - React-admin - Marmelab
This component fetches a list of referenced records by a reverse lookup of the current record.id in the target field of another resource...
Read more >Is it possible to add user search filters to a ... - Stack Overflow
I did notice the moment the List component is injected, the ReferenceManyField target value is ignored. Your code has a { user: record.id...
Read more >How To Display The Id Of An Item In A List Resource And A ...
The Datagrid should only see records with the target value filter applied. ... Datagrid within ReferenceManyField showing rows but no data.
Read more >Is it possible to add user search filters to a ... - Anycodings.com
Answers 2 : of Is it possible to add user search filters to a ReferenceManyField in React Admin v3 ; ReferenceManyField reference="some-reference" target="some- ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Experiencing the same issue - any resolution here?
No news for some time, closing.