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

deselect chips programmatically in chiplist

is there some way I can deselect a selected chip dynamically in the code  in a chiplist with multiple selection? 

Thanks


3 Replies

CI Christopher Issac Sunder K Syncfusion Team June 7, 2019 08:30 AM

Hi thao, 

Greetings from Syncfusion support. 

We have achieved your requirement by selecting the item again using select method. That helps you to deselect a selected item. 

this.chip.select(3); 

We have created a sample for deselecting a selected item. Please refer the sample link given below 


Please get back to us if you require any further assistance. 

Thanks,
Christo 



TT ttArbor June 7, 2019 09:48 AM

I've tried that but it doesn't really turn out as expected. From what I see is   'select' method pretty much toggling the chip. 

For example: if there are [1,2,3] selected. Calling  this.chip.select(3) will deselect [3] , which is not something expected.  



CI Christopher Issac Sunder K Syncfusion Team June 10, 2019 07:27 AM

Hi thao, 

Thanks for the update. 

When you want to deselect an entire selected chip, we need to pass the selected chips index position to chips “select” method. Please refer the code snippets given below. 

this.chipIndex = this.chip.element.ej2_instances[0].getSelectedChips().Indexes; 
this.chip.select(this.chipIndex); 

please refer the online sample given below. 

Please get back to us if you require any further assistance. 

Thanks,
Christo 


Loader.
Live Chat Icon For mobile
Up arrow icon