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:
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.