Hello.
I'm trying to clear the selection of a combo programatically after selecting a few items. What I'm trying to achieve can be seen on the following codepen: http://codepen.io/anon/pen/dOrEXe . However I'm having trouble because $("#combo").igCombo("index", -1); and $("#combo").igCombo("activeIndex", -1); aren't resetting the combo's selection.
Any help with this matter would be greatly appreciated.
Thank you for your time.
Hello João Pinto,
Thank you for posting in our community!
I would like to provide you a link to our combo API and especially to documentation for initialSelectedItems -
http://www.igniteui.com/help/api/2016.2/ui.igCombo#options:initialSelectedItems, which is closely related to the case. It says: " If initialSelectedItems are not set, the combo is with single selection and it is in a dropdown, readonly or readonlylist mode, the first item will be automatically selected."
This is what happens in your scenario. If you remove the set mode, then the combo will behave as you expect.
So, isn't there a way to have a combobox in "dropdown" mode without having a selected element? Like, for example, having a combobox with a dataSource: ["Testes1", "Teste2", "Teste3"], mode: "dropdown", but instead of showing one of the options from the dataSource instead show the placeholder that could say, for example, "Select an item"?
Hi João Pinto,
There is no straight way to achieve that.
The workaround is to add one empty-state item as the first and it should be selected by default. Its text could be "Select an item". But it would be in the list of items when you expand the dropdown.
Let us know whether you need any additional assistance!