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
585
WebDropDown selection behavior
posted

I want to use a WebDropDown with checkbox multiselection. I have an underlying string array of data that needs to match the ticked checkboxes.

There are a few issues I've encountered:

  1. the first few times I click the arrow to open the dropdown, nothing happens. There's no error in the browser console either, so I'm not sure. It seems the first time the page loads, I need to click at least thrice for the dropdown to actually appear.
  2. every time I check or uncheck an item, the dropdown closes. It's slightly annoying to quickly check multiple items this way.
  3. I can update the selection from JS, but it only seems to affect the checkboxes. The dropdown text itself doesn't get updated.

The dropdown code itself is simply:

<ig:WebDropDown ID="MyDropDown" EnableMultipleSelection="true" MultipleSelectionType="Checkbox"
                runat="server" Width="200px" />

In various places, I need to updated the selection from the data source. The JS to do that is:

if (dataSource != undefined) {
    var ddItems = $IG.WebDropDown.find("cph_mainpage_MyDropDown").get_items();

    for (var i = 0; i < ddItems.getLength(); i++) {
        var ddItem = ddItems.getItem(i);

        if (dataSource.includes(ddItem.get_text()))
            ddItem.select();
        else
            ddItem.unselect();
    }
}

I've also tried calling activate() and inactivate() on the items, and calling invalidateCache() on the dropdown.

I'm hoping that for issue 2, there's simply some "allow selecting multiple items in one go" property I need to set somewhere, and for 3, i can somehow force the drop-down to refresh its state from the items.

Parents
No Data
Reply
  • 1700
    Offline posted

    Hello Sören,

    For your first issue, I have tested it out on version 21.1. and version 20.2 and there was no issue with opening the WebDropDown. Regarding it I have 2 questions:

    Which version of Infragistics Controls are you using?

    How are you assigning the data source for the WebDropDown and how big is this data source? If the data is enormous, it might cause the control to load slowly.

    To overcome this there are a few ways of improving performance:

    Disable ASP.NET ViewState - EnableViewState=false.

    Make sure AutoFiltering is not set to "Client". not sure which version you are using, but if you are using a more recent one, items objects will be lazy-loaded, in that case, improving performance a lot.

    Enable load on demand, so only a certain number of items would be loaded in the control initially.

    For your second issue, as you predicted there is a property called “EnableClosingDropDownOnSelect” simply setting it to false would allow you to select multiple items, without closing the WebDropDown. 

    As for the last issue, I have created a small sample application, where I modify the selected items of the WebDropDown inside a button click event, where the selected items are checked inside the dropdown list and are also present in the text portion of the WebDropDown, so this again may be related to using an older version.

    Please test it on your side and let me know if this is an accurate demonstration of what you are trying to achieve. If this is not an accurate demonstration of what you are trying to achieve, please feel free to modify it and send it back to me along with steps to reproduce.

    Looking forward to hearing from you.

    Regards,
    Ivan Kitanov

     

    MultiselectWebDropDown.zip

Children