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
2048
How to set selectedIndexes on igCombo with "onWithCheckboxes" multiSelection option
posted

Hi all,
I am not able to solve the following issue.
I created an igCombo with these features:

$("#comboXXX").igCombo({
width: "85%",
textKey: fieldTextKey,
valueKey: "Id",
dataSource: data,
autoComplete: true,
filteringType: "local",
renderMatchItems: "startsWith",
dropDownOnFocus: true,
multiSelection: "onWithCheckboxes"
});

igCombo correctly renders, with all items visible. I check 3 items and I would like to see, by a javascript function, a list of all checked items (or indexes).
When I try the following one:

$("#comboXXX").igCombo("selectedIndex");

I can just see one index. So I try this:

$("#comboXXX").igCombo("option","selectedItems"); 

And I can see 3 items, with index, text and value properties. That's ok.

Now, what I would like to do is to call a method that can deselect one or more items, triggering igcomboselectionchanged event.

How can I do it?

I tried with: 

$("#comboXXX").igCombo("option", "selectedItems", [{ index: 0 }, { index: 1 }]);

This selects indexes in a right way but, of course, it does not trigger igcomboselectionchanged...

Thanks in advance

Flavio M.

  • 2048
    Verified Answer
    posted

    Hi,

    for the moment I just tried to solve the issue with the following approach:

    var text = [];
    $.each($("#comboXXX).igCombo("option", "selectedItems"), function (key, obj) {
       if (obj.index != objectIndexToRemove)
          text.push(obj.text);
       });
    $("#combo_XXX").igCombo("text", text.join(', '), true);


    I was trying with:

    $("#combo_XXX").igCombo("text", $("#combo_XXX").igCombo("text")true);


    But it didn't fire onSelectionChanged event, even if I set true as last parameter. This probably happened because igCombo object did not see any changes?

    If there are better ways, please suggest me.

    Thanks

    Flavio M.


  • 2048
    posted

    Any ideas?

    Probably it is more simple than all the things I wrote.

    I just need a way to fire igcomboselectionchanged event...

    Thanks

    Flavio M.