marmelab / react-admin

A frontend Framework for single-page applications on top of REST/GraphQL APIs, using TypeScript, React and Material Design
http://marmelab.com/react-admin
MIT License
24.99k stars 5.25k forks source link

Add custom item in ReferenceArrayInput #1893

Closed alihesari closed 4 years ago

alihesari commented 6 years ago

This component fetches the possible values in the reference resource. If I want to select All values, I need a Select All item. Values in the reference resource don't have Select All item and I don't want add Select All item in the reference resource json to display it in ReferenceArrayInput list. So in my opinion, you add a new feature to display Select All item or any custom item in ReferenceArrayInput list.

<ReferenceArrayInput source="tag_ids" reference="tags" customItems={[ {'selectAll': 'select All'}, {'Key': 'Value'}]}>
    <SelectArrayInput optionText="name" />
</ReferenceArrayInput>
fzaninotto commented 6 years ago

-1 for your solution: it's not the job of the <ReferenceArrayInput> to provide that feature, but of its child. Think about the case where the <SelectArrayInput> is replaced by a double list with a buttons to select/deselect an item. A "select all" option wouldn't make sense in that case.

image

So if the enhancement needs to be done, it's by a allowSelectAll prop in the `SelectArrayInput`` component.

alihesari commented 6 years ago

@fzaninotto Yes, you are right. Thank you for the explanation.

DanStorm commented 5 years ago

Any progress on this enhancement or is a work around possible? A method to 'Select All/ Deselect All' for ReferenceArrayInput:SelectArrayInput is very important functionality for our app. Thanks!

fzaninotto commented 5 years ago

The core team won't work on this feature for the near future, as we don't need it. Feel free to open a Pull Request for it.

jdemangeon commented 4 years ago

According the previous message and the activity on this issue, I closing it.