Please refer to your official sample/demo page: https://ko.infragistics.com/samples/aspnet/drop-down/multi-selection
Is this by design? What is the point of allowing selection using checkboxes if there is no reliable way to access them using the selecteditems array?
Is there any way to get the list of items that are currently checked?
I am not using the edit control part of the drop down. I have disabled it by setting the DisplayMode to DropDownList and with "eventArgs.set_cancel(true);" in the ValueChanging client-side event.
I have a separate label on the page where I display a comma delimited list of the currently selected items using the following client-side function triggered on SelectionChanged:
function onSelectedIndexChanged(sender, eventArgs) { var Items = eventArgs.getNewSelection();
var ItemsString = ""; var Delimiter = "";
if (Items.length > 1) Delimiter = ", ";
for (i = 0; i < Items.length; i++) { ItemsString += Items[i].get_text(); if (i < (Items.length - 1)) ItemsString += Delimiter; }
$get("<%=selLabel.ClientID%>").innerHTML = ItemsString;}
Just as in your demo, this only works as long as the user uses their mouse to check and uncheck the items' checkboxes. The moment they use the keyboard to navigate through the list, it breaks.
To reiterate, is there any way I can get a list of items that are checked?
If not, is there any way I can disable navigating through the list using the keyboard? Using "eventArgs.set_cancel(true);" for the InputKeyUp and InputKeyDown events does not help. Any other thoughts?
Thanks.
Wanted to add that I've tested/observed the above with the following browsers: IE 6, IE 8, Firefox 3.5 and Chrome 3 on WIndows XP.
Hi,
You are right that this behavior described in step 5 is not correct. Home key selects top item, and deselects everything else, so the array of selected items is correct - the incorrect behavior is that checkboxes (not items, but the checkbox elements) are still showing as checked.
You can easily "workaround" this by attaching to the SelectionChanged handler, and clearing the checkbox of any item that is not internally marked as selected:
if (!item.get_selected() && dropDown.get_multipleSelectionType() == $IG.DropDownMultipleSelectionType.Checkbox)
{
item._element.childNodes[0].checked=false;
}
This needs to be fixed internally, for sure, and I will submit a bug request for that.
Thanks for your feedback !
Angel