jQuery UI Widgets › Forums › Lists › ListBox › Doubleclick to select item
This topic contains 3 replies, has 3 voices, and was last updated by Pietervk 7 years, 6 months ago.
Viewing 4 posts - 1 through 4 (of 4 total)
-
Author
-
How to have doubleclick to select an item instead of just ‘select’?
Hello bobsov,
Unfortunately, this functionality is not supported. However, you may find the following workaround useful:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head> <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" /> <script type="text/javascript" src="../../scripts/gettheme.js"></script> <script type="text/javascript" src="../../scripts/jquery-1.10.2.min.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxlistbox.js"></script></head><body> <div id='content'> <script type="text/javascript"> $(document).ready(function () { var theme = ""; var source = [ "Affogato", "Americano", "Bicerin", "Breve", "Café Bombón", "Café au lait", "Caffé Corretto", "Café Crema", "Caffé Latte", "Caffé macchiato", "Café mélange", "Coffee milk", "Cafe mocha", "Cappuccino", "Carajillo", "Cortado", "Cuban espresso", "Espresso", "Eiskaffee", "The Flat White", "Frappuccino", "Galao", "Greek frappé coffee", "Iced Coffee", "Indian filter coffee", "Instant coffee", "Irish coffee", "Liqueur coffee" ]; // Create a jqxListBox $("#jqxWidget").jqxListBox({ selectedIndex: 3, source: source, width: 200, height: 250, theme: theme }); $("#jqxWidget .jqx-listitem-element").click(function (event) { var label = event.target.innerHTML; var index = source.indexOf(label); var that = this; setTimeout(function () { var dblclick = parseInt($(that).data('double'), 10); if (dblclick > 0) { $(that).data('double', dblclick - 1); } else { $("#jqxWidget").jqxListBox('unselectIndex', index); } }, 300); }).dblclick(function (event) { $(this).data('double', 2); }); }); </script> <div id='jqxWidget'> </div> </div></body></html>
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Thank you for the work around.
-
AuthorPosts
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.