Hi,
I have a webdropdown with enable multiple selection set to true. I want to clear the checked chekboxes within the drop down on rthe client side using Javascript. I referred to http://community.infragistics.com/forums/p/30177/161244.aspx#161244 which shows how to do this for a single selection dropdown.
how do I clear the multi-select dropdown and reset the current value to say "select"?
This is the code from the other post for single selectio which does not work for the multi-select.
<script type="text/javascript">
function clearSelection() {
var dropDown = $find("WebDropDown1");
var item = dropDown.get_items().getItem(dropDown.get_selectedItemIndex());
if (item != null) {
item.unselect();
item.inactivate();
// optionally, clear input text
// dropDown.set_currentValue("",true);
}
return false;
Thank you.
Dear longpond
Thank you for contacting Infragistics!
We received your support request concerning clearing the items for the multiselect Webdropdown, and this case has been assigned to me. Infragistics is dedicated to helping you solve this issue.
I am looking into this issue and will get back to you by the end of the day Wednesday with more information.
Hello longpond,
To clear the items for the multiselect WebDropDown , you need to iterate through all the selected items and unselect them like below.
function clearSelection() { var dropDown = $find('WebDropDown1'); dropDown.set_currentValue('', true); var items = dropDown.get_items(); for (var i = items.get_length() - 1; i >= 0; i--) { var item = items.getItem(i); if (item.isSelected() && item != null) { item.unselect(); item.inactivate();} } }
var dropDown = $find('WebDropDown1');
dropDown.set_currentValue('', true);
var items = dropDown.get_items();
for (var i = items.get_length() - 1; i >= 0; i--) {
var item = items.getItem(i);
if (item.isSelected() && item != null) {
item.inactivate();} } }
Please let me know if I can provide any further assistance regarding this matter.