Search code examples
javascriptjqueryinfragisticsignite-uiigcombo

Need to create variable with multiple checkbox selected values of igCombo


var selectedoptions = $("#spanid").igCombo("option","multiSelection")

Variable selectedoptions has an igCombo data structure but I need this variable to have string values of the checkbox users select. I am not able to get the correct values. any help?

Ignite UI is the library in case if anyone is wondering.


Solution

  • The multiSelection option will give you the configuration object for the multiple selection in the igCombo. In order to extract the selected items you need to use the selectedItems API method.

    var items = $(".selector").igCombo("selectedItems");
    var firstItemData = items[0].data;
    var $firstItemLi = items[0].element;
    

    https://www.igniteui.com/help/api/2017.2/ui.igcombo#methods:selectedItems