We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Multiselect dropdown only one value selectable

Hello!


I'm currently using the ejs-multiselect component in my project and I have a specific requirement:

How can I configure the ejs-multiselect component to allow selecting only one value at a time? I have a unique situation in my system where I need this component to restrict selection to a single item, and I also want to remove the "Select All" option.

Could someone provide guidance on achieving this configuration?

Thanks!

Adriana


1 Reply

UD UdhayaKumar Duraisamy Syncfusion Team April 14, 2024 10:58 AM UTC

You can limit the selection to a single item in the ejs-multiselect component by setting the "maximumSelectionLength" property to 1. This property sets a limitation on the value selection, and based on this limitation, list selection will be prevented. As for removing the “Select All” option, you can achieve this by setting the showSelectAll property to false.


Here’s how you can set it:

  <ejs-multiselect

    id="multiselect-checkbox"

    #checkbox

    [dataSource]="countries"

    maximumSelectionLength="1"

    [placeholder]="checkWaterMark"

    [fields]="checkFields"

    [mode]="mode"

    [showDropDownIcon]="true"

    showSelectAll="false"

    [filterBarPlaceholder]="filterPlaceholder"

  ></ejs-multiselect>


Sample: https://stackblitz.com/edit/angular-y5lbfx?file=src%2Fapp.component.html


You can also refer to the below shared documentation for more information,


Loader.
Live Chat Icon For mobile
Up arrow icon