Please refer to your official sample/demo page: https://es.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.
Hi,
In general I agree with all of your suggestions. We will discuss these scenarios and decide which bug(s) to create. In the meantime I will try to send you a sample WebSite where it works as you expect, by the end of Monday (27th July), if this is fine for you.
The service release for July has been already shipped, therefore the earliest these potential changes about multiple checkbox selection can go in officially is for the August Service release.
I think it should be small amount of code to implement this behavior using the control's client-side events framework.
Hope it helps,
Angel
Hello Angel,
Thanks for the reply. I tried your workaround and have a few issues.
When each list item has a checkbox, the following are expected behavior:
Can you please help me acheive this functionality in the current release. If not, will it be possible to add this behavior/functionality into the patch scheduled for release next week (I recall reading that a patch is due the last week of July).
If this functionality cannot be added soon, is there a way for me to trap the keypress event for the edit/input field? I don't mind losing keyboard navigation for this control for now. If the users can just scroll and use the mouse to select using the checkboxes, that is all I need for now. I have tried binding the keypress event to the Input Element, but, that doesn't seem to do anything.
Any suggestions? Please? I have a deadline to have this part of the application done by the end of July. I can probably push it out by a week, but, need to have this resolved by then.
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 !
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.