Display list object select
Hello !
I get feedback like this
I retrieve this data via a useForm
And i want, in a Form.Item, show all the clients name of the retrieve data in a select tag, how ?
6 Replies
Hi @realdragonma. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Hmm, I don't know enough to give you a confident answer yet. However, you can refer to the refine documentation (https://refine.dev/docs) for more information and examples on how to use
useForm
and other hooks.
----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:
----------------------Overview | refine
What is refine?
<@214840332943097856> kapa.ai is still learning and improving, please let us how it did by reacting below
optimistic-goldOP•2y ago
@kapa.ai
I'll tell you more then
Here is my class :
The queryResults?.data?.data is something like this :
exemple :
So, i just want to show in the select, the clients of the retrieve data (just by her id)
So with this exemple, i just want that when i load the page, my select is prefill with
"yes-yes"
Do you understand ?
Let me check the knowledge base for you. One moment! :books:
----------------------
I understand your requirement now. You want to prefill the select component with the clients' ids from the retrieved data. You can achieve this by setting the
defaultValue
prop in the useSelect
hook.
First, extract the clients' ids from the queryResult
:
Then, pass the clientIds
as the defaultValue
prop in the useSelect
hook:
Now, your select component should be pre-filled with the clients' ids from the retrieved data.
----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:
----------------------<@214840332943097856> kapa.ai is still learning and improving, please let us how it did by reacting below