Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
35
how to set several selected items in igcombo with multiSelection: "onWithCheckboxes"
posted

How do I set more than one selected item in an igcombo with multiSelection: "onWithCheckboxes"?  I want to set the igcombo to values that the user selected the last time they used the combo.

I am having a very hard time finding an information on it.  here is an example of some of the things I have tried....Thanks for any help.

function SetProjectManagerDropDown(projectmanagerdata) {

var obj = {};

for (var i = 0; i < projectmanagerdata.length; i++) {

// obj[i] = projectmanagerdata[i].user_id;

$(

"#Proj_comboProjectManager").igCombo("value", projectmanagerdata[i].user_id);

}

// $("#Proj_comboProjectManager").igCombo("option", "selectedItems", obj);

}

  • 10685
    Suggested Answer
    Offline posted

    Hello Cory, 

    It is important to note, in general the idea behind using the igCombo with multiSelection/onWithCheckboxes is to select multiple items when checking the desired checkboxes. It is important to notice, the current default behavior when using the Combo is to select  just one item when clicking on any item text(actually clicking anywhere on an item except the item’s checkBox), OR  select multiple items when clicking on each of the desired checkboxes. The difference is that if you click anywhere on the items but the checkboxes, it will actually collapse the items and set the chosen item for the Combo. If selecting the checkboxes, the Items list will not collapse but remain open, awaiting for additional selections to be made and included in the selectedItems objects collection. An online sample illustrating this could be found at: http://igniteui.com/combo/selection-and-checkboxes  

    To the point:
    It is possible to get the current selectedItems using
    var selectedItemsCollection = $("#Proj_comboProjectManager").igCombo("option", "selectedItems"); 

    and set it when required to the igCombo passing the array of objects collection using
    $("#Proj_comboProjectManager").igCombo("option", "selectedItems", selectedItemsCollection); 

    Please let me know if you have any questions regarding this.

  • 10685
    Offline posted

    Please let me know if you find my suggestions helping you, or in case you require further assistance.