Closed devnull69 closed 1 year ago
This pull request is automatically built and testable in CodeSandbox.
To see build info of the built libraries, click here or the icon next to each commit SHA.
Latest deployment of this branch, based on commit 5bdd2ae0f7882d0a9470e45bbb11bede342a9d3b:
Sandbox | Source |
---|---|
react-dropdown-select | Configuration |
@devnull69 Thanks for the PR. I read the changes briefly, and I have to say that I still dont really see the point. I mean this can be easily achieved by just:
const options = [
{ value: 1, label: "Leanne Graham" },
{ value: 2, label: "Ervin Howell" }
];
<Select
options={options}
values={[]}
onChange={(values) => values.map(v => ({ v.value }))} // <-- here
/>
I am still not convinced this is contributes to the lib as apose to complexity it is adding.
I don't think so. Would it also allow to set the initial value like this?
<Select
options={options}
values={[1]}
onChange={(values) => values.map(v => ({ v.value }))} // <-- here
/>
so that the first entry gets selected? This is exactly what I would need to have ... a dropdown/select component that can take ANY kind of object, specify a unique key as valueField, and handle all its values as an array of valueField properties.
For database applications, this is what I am always doing. If you want to access a file in a directory, you are only providing the full path ... you won't provide the full content of the file in your dropdown, would you? I think, it is the same thing. I would like to only have the IDs, not all the content.
But then again. No consistency with the options. Options is still an object. No change in that. And IMHO if you need to map the options - why not mapping the values outside as well.
I see your point in example with files. But the case is super rare, no?
On Tue, Aug 1, 2023, 10:00 PM Thomas Theiner @.***> wrote:
I don't think so. Would it also allow to set the initial value like this?
<Select options={options} values={[1]} onChange={(values) => values.map(v => ({ v.value }))} // <-- here />
so that the first entry gets selected? This is exactly what I what need to have ... a dropdown/select component that can take ANY kind of object, specify a unique key as valueField, and handle all its values as an array of valueField properties.
For database applications, this is what I am always doing. If you want to access a file in a directory, you are only providing the full path ... you won't provide the full content of the file in your dropdown, would you? I think, it is the same thing. I would like to only have the IDs, not all the content.
— Reply to this email directly, view it on GitHub https://github.com/sanusart/react-dropdown-select/pull/294#issuecomment-1660909816, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACBLRQNWZAFINPEUAG4VDLXTFG4BANCNFSM6AAAAAA272DDUE . You are receiving this because you commented.Message ID: @.***>
I changed