Skip to content

Commit b29e512

Browse files
authoredMay 17, 2021
Merge pull request #6281 from WiXSL/fix-md-tags
[Doc] Improve readability of ReferenceInput examples
2 parents 043084e + 5294f66 commit b29e512

File tree

2 files changed

+29
-22
lines changed

2 files changed

+29
-22
lines changed
 

‎docs/Fields.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,7 @@ Also, you can filter the query used to populate the possible values. Use the `fi
988988

989989
This [Enterprise Edition](https://marmelab.com/ra-enterprise)<img class="icon" src="./img/premium.svg" /> component fetches a list of referenced records by lookup in an associative table, and passes the records down to its child component, which must be an iterator component.
990990

991-
For instance, here is how to fetch the authors related to a book record by matching book.id to book_authors.post_id, then matching book_authors.author_id to authors.id, and then display the author last_name for each, in a <ChipField>:
991+
For instance, here is how to fetch the authors related to a book record by matching book.id to book_authors.post_id, then matching book_authors.author_id to authors.id, and then display the author last_name for each, in a `<ChipField>`:
992992

993993
```jsx
994994
import * as React from 'react';

‎docs/Inputs.md

+28-21
Original file line numberDiff line numberDiff line change
@@ -1939,27 +1939,30 @@ You can tweak how this component fetches the possible values using the `perPage`
19391939
// by default, fetches only the first 25 values. You can extend this limit
19401940
// by setting the `perPage` prop.
19411941
<ReferenceArrayInput
1942-
source="tag_ids"
1943-
reference="tags"
1944-
perPage={100}>
1942+
source="tag_ids"
1943+
reference="tags"
1944+
perPage={100}
1945+
>
19451946
<SelectArrayInput optionText="name" />
19461947
</ReferenceArrayInput>
19471948

19481949
// by default, orders the possible values by id desc. You can change this order
19491950
// by setting the `sort` prop (an object with `field` and `order` properties).
19501951
<ReferenceArrayInput
1951-
source="tag_ids"
1952-
reference="tags"
1953-
sort={{ field: 'title', order: 'ASC' }}>
1952+
source="tag_ids"
1953+
reference="tags"
1954+
sort={{ field: 'title', order: 'ASC' }}
1955+
>
19541956
<SelectArrayInput optionText="name" />
19551957
</ReferenceArrayInput>
19561958

19571959
// you can filter the query used to populate the possible values. Use the
19581960
// `filter` prop for that.
19591961
<ReferenceArrayInput
1960-
source="tag_ids"
1961-
reference="tags"
1962-
filter={{ is_published: true }}>
1962+
source="tag_ids"
1963+
reference="tags"
1964+
filter={{ is_published: true }}
1965+
>
19631966
<SelectArrayInput optionText="name" />
19641967
</ReferenceArrayInput>
19651968
```
@@ -2061,27 +2064,30 @@ You can tweak how this component fetches the possible values using the `perPage`
20612064
// by default, fetches only the first 25 values. You can extend this limit
20622065
// by setting the `perPage` prop.
20632066
<ReferenceInput
2064-
source="post_id"
2065-
reference="posts"
2066-
perPage={100}>
2067+
source="post_id"
2068+
reference="posts"
2069+
perPage={100}
2070+
>
20672071
<SelectInput optionText="title" />
20682072
</ReferenceInput>
20692073

20702074
// by default, orders the possible values by id desc. You can change this order
20712075
// by setting the `sort` prop (an object with `field` and `order` properties).
20722076
<ReferenceInput
2073-
source="post_id"
2074-
reference="posts"
2075-
sort={{ field: 'title', order: 'ASC' }}>
2077+
source="post_id"
2078+
reference="posts"
2079+
sort={{ field: 'title', order: 'ASC' }}
2080+
>
20762081
<SelectInput optionText="title" />
20772082
</ReferenceInput>
20782083

20792084
// you can filter the query used to populate the possible values. Use the
20802085
// `filter` prop for that.
20812086
<ReferenceInput
2082-
source="post_id"
2083-
reference="posts"
2084-
filter={{ is_published: true }}>
2087+
source="post_id"
2088+
reference="posts"
2089+
filter={{ is_published: true }}
2090+
>
20852091
<SelectInput optionText="title" />
20862092
</ReferenceInput>
20872093
```
@@ -2092,9 +2098,10 @@ The child component may further filter results (that's the case, for instance, f
20922098

20932099
```jsx
20942100
<ReferenceInput
2095-
source="post_id"
2096-
reference="posts"
2097-
filterToQuery={searchText => ({ title: searchText })}>
2101+
source="post_id"
2102+
reference="posts"
2103+
filterToQuery={searchText => ({ title: searchText })}
2104+
>
20982105
<AutocompleteInput optionText="title" />
20992106
</ReferenceInput>
21002107
```

0 commit comments

Comments
 (0)