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
555
Ig Combo box - Multi select - Select All
posted

Hi,

I am using Ig combo with multi select option with checkboxes in ASP.NET MVC

@(Html.Infragistics()

.Combo()

.ID("Ids")

.MultiSelectionSettings(s => { s.ShowCheckBoxes(true); s.Enabled(true); })

.DataSource(@ViewBag.Ids.Items)

.TextKey("Description")

.ValueKey("ID")

.Width("280px")

 .Render())

Then binding the onChange event like this:

$("#Ids").bind("igcomboselectionchanging", OnIdsSelected);

function OnIdsSelected(evt, ui) {

if(ui.items[0].data.ID == -1)

{

//Select all checkboxes

}

}

I am not sure how to select all the remaining checkboxes in the combo box when the first item is selected.

I tried $("#Ids").igCombo("Items") but this doesn't give me all the items

Can someone please suggest the correct syntax for this?

Regards

Singh

  • 845
    Offline posted

    Hello Singh,

    Thank you for contacting Infragistics Developer Support!

    In your case you can use the selectAll method of the combo i.e

    $("#checkboxSelectCombo").bind("igcomboselectionchanging", function(evt, ui) {
      if (!ui.currentItems && ui.items && ui.items[0].data.ID === -1) {
         ui.owner.selectAll();
         return false;
       }
    });

    However you would have to cancel the selectionChanging event. A better approach is to use a header template where you can place a button/checkbox/etc and call the selectAll method through the igCombo API. 

    For more information check: this and this and a sample showing off the header template feature