-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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 displayFields in the Relation widget #1303
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ The relation widget allows you to reference items from another collection. It pr | |
- **Options:** | ||
- `default`: accepts any widget data type; defaults to an empty string | ||
- `collection`: (**required**) name of the collection being referenced (string) | ||
- `displayFields`: list of one or more names of fields in the referenced collection that will render in the autocomplete menu of the control. The value field is used by default. | ||
- `searchFields`: (**required**) list of one or more names of fields in the referenced collection to search for the typed value | ||
- `valueField`: (**required**) name of the field from the referenced collection whose value will be stored for the relation | ||
- **Example** (assuming a separate "authors" collection with "name" and "twitterHandle" fields): | ||
|
@@ -22,7 +23,8 @@ The relation widget allows you to reference items from another collection. It pr | |
name: "author" | ||
widget: "relation" | ||
collection: "authors" | ||
displayFields: ["twitterHandle", "followerCount"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Drop this to the bottom (optional field). |
||
searchFields: ["name", "twitterHandle"] | ||
valueField: "name" | ||
``` | ||
The generated UI input will search the authors collection by name and twitterHandle as the user types. On selection, the author name will be saved for the field. | ||
The generated UI input will search the authors collection by name and twitterHandle as the user types. Each collection will be represented by the author's handle and follower count. On selection, the author name will be saved for the field. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Combine this change into the first sentence, so the first sentence reads:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace last sentence with: