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 - Don't open dropdown on chip selection event.

I have a multiselect control on my page and am using the chipSelection to toggle the chip color.
The color is correctly toggled when a user clicks on a chip, but the issue is the dropdown box opening as well when this happens.
Is there a way prevent the dropdown box from opening if the click occurs on a chip?

<ejs-multiselect
     ...
     chipSelection="onSelection"
     ...
 </ejs-multiselect>

<script>
function onSelection(e) {
     $(e.currentTarget).toggleClass("selected")
}
</script>

<style>
    .e-chips.selected {
        background-color: #3848BF !important;
    }
</style>

3 Replies

VK Vinoth Kumar Sundara Moorthy Syncfusion Team August 20, 2019 09:01 AM

Hi Jesse, 
 
Good day to you. 
 
We have checked your requirement and restricted opening the popup while performing chip selection in the open event. Please refer the below code example, 
 
Code Example 
<ejs-multiselect id="local" placeholder="Select games" dataSource="@ViewBag.data" chipSelection="onSelection" open="onOpen"> 
    <e-multiselect-fields text="Game" value="Id"></e-multiselect-fields> 
</ejs-multiselect> 
 
<script> 
    var isSelection = false; 
    function onSelection(e) { 
        $(e.currentTarget).toggleClass("selected"); 
        isSelection = true; 
    } 
    function onOpen(args) { 
        if (isSelection) { 
            args.cancel = true; 
            isSelection = false; 
        } 
    } 
</script> 
 
For your convenience, we have prepared the sample and same can be found in below link, 
 
Could you please check the above sample and get back to us if you need any further assistance? 
 
Regards, 
Vinoth Kumar S 



JE Jesse August 20, 2019 04:33 PM

You are a champion Vinoth!!

Thanks heaps, keep up the good work :)


VK Vinoth Kumar Sundara Moorthy Syncfusion Team August 20, 2019 09:50 PM

Hi Jesse, 
  
Thank you for the appreciation. Please feel free to contact us if you need any further assistance on Syncfusion components. 
  
Regards, 
Vinoth Kumar S 


Loader.
Live Chat Icon For mobile
Up arrow icon