Select all option in FormMultiselect component

1 Answer 95 Views
General Discussions
Abhishek
Top achievements
Rank 2
Iron
Iron
Iron
Abhishek asked on 27 Oct 2023, 10:16 AM
How to add select all option in form multiselect component. i am passing data as object with country code & country name for the component

1 Answer, 1 is accepted

Sort by
0
Wissam
Telerik team
answered on 30 Oct 2023, 12:41 PM

Hello, Abhishek,

We have a Knowledge Base article that implements selecting all the items using a `Select All` option. It also renders a checkbox element next to each item using the itemRender property but you can remove it if it is not required in your use case scenario:

Please check it and let me know if you have any further questions.

Regards,
Wissam
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources!

Abhishek
Top achievements
Rank 2
Iron
Iron
Iron
commented on 30 Oct 2023, 02:32 PM

Hi Wissam, thank you for the info. I am looking for select all option in FormMultiselect Component. Kindly help
Wissam
Telerik team
commented on 01 Nov 2023, 11:47 AM

Hi, Abhishek,

I prepared an example of the MultiSelect component with the select all option in the KendoReact Form.

This approach requires handling the `onChange` coming from the `fieldRenderProps` in the `onChange` handler of the MultiSelect component, where you can set the value in the event to the calculated value:

fieldRenderProps.onChange({
      target: event.target,
      value: { value },
    });

In addition, the you should pass `state.value` to the MultiSelect component instead of the value coming from the fieldRenderProps. Therefore, I am setting the value under `{...others}`:

Moreover, I could see that you submitted a feature request for the same question. Therefore, I will delete it in order to keep the information consistent:

Regards,
Wissam
Progress Telerik
Abhishek
Top achievements
Rank 2
Iron
Iron
Iron
commented on 08 Nov 2023, 12:03 PM

I am looking for example which has the response with key value pair. in the above mentioned example we have only country name. In my case, i have both country name & country code
Wissam
Telerik team
commented on 10 Nov 2023, 06:06 AM

Hello, Abhishek,

Thank you for getting back to me with more information.

I believe that you are binding the MultiSelect data to a dataset of objects. Is this correct?

I updated the example such that I am setting the data to an array of objects, and in `handleChange`, in the first two lines I changed `i` to `i.text` since the `i` now refers to the object that contains the text and id properties. In addition, I added the `textField` and `dataItemKey` properties to the MultiSelect component:

I hope this helps.

Regards,
Wissam
Progress Telerik
Tags
General Discussions
Asked by
Abhishek
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Wissam
Telerik team
Share this question
or