Is it possible to allow users to click on an already-selected item in a dropdown, and have the dropdown close? I'd like to do this both with a plain WebDropDown, and one that contains a WebDataGrid for multicolumn display.
Hello PV87669,
Thank you for your reply and feedback.
Please let me know if you have any further questions regarding this matter.
Sorry, corrected...
function ddGrower_itemMouseDown(sender, e) {
var sel = e.get_value().get_selected();
if ((sel) && (sel == _previous_saved_value) )
sender.closeDropDown();
}
Thanks.
I had a problem if the click is very brief; the dropdown would close and immediately re-open. It worked fine with a brief pause while the button is down.
I got more consistent behaviour with:
function WebDropDown1_ItemMouseDown(sender, eventArgs) if (eventArgs.get_value().get_selected() == previously_saved_value) { sender.closeDropDown(); }
Thank you for posting in the community.
When using a regular WebDropDown, you may handle theItemMouseDownclientside event in order to check whether the clicked item is already selected:
Please let me know if this helps.
When the WebDropDown contains a WebDataGrid, I can use
<ig:WebDataGrid ID="wdgMyList" runat="server" AutoGenerateColumns="False" DataSourceID="dsMySource" ShowHeader="False" ClientEvents-MouseUp="ddMyList_close">
function ddMyList_close(sender, e) { var ddMyDD = $find('<%=ddMyDD.ClientID %>'); ddMyDD.closeDropDown(); }
Still unsure how to handle a plain WebDropDown that doesn't contain a grid.