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.
Hi
I am using webdropdown having single selection.
i want to select another value from the client side.
i am calling below client side functions but not able to clear previously selected value
var MyDropdown = $find("<%=WebDropDown.ClientID%>");var item = MyDropdown.get_selectedItem();if (item != null) {item.unselect();item.inactivate();}return false;}
for selection i am using below function
function MySelect()
{
milestoneRAG.set_currentValue('[Select]', true);
WebDropDown.set_enabled(true); var item = WebDropDown.get_items().getItem(1); if (item != null)
{ item.select(); item.activate(); }
after calling MySelect() client side function i am not getting newly selected value in the alert message $find(Webdropdown.clientid).get_selectedItem().get_value()
Hello Longpond,
Please let me know if i can provide any further assistance regarding this matter.