jQuery UI Widgets Forums Lists ListBox double click on listBox

This topic contains 1 reply, has 2 voices, and was last updated by  Dimitar 10 years ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • double click on listBox #55044

    jahnvi25
    Participant

    is there a way to implement double click to select item in listBox ?

    double click on listBox #55066

    Dimitar
    Participant

    Hello jahnvi25,

    Here is how to implement listbox item selection on double click:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
        <script type="text/javascript" src="../../scripts/jquery-1.10.2.min.js"></script>
        <script type="text/javascript" src="../../scripts/demos.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 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, enableSelection: false });
                    $("#jqxWidget .jqx-listitem-state-normal").dblclick(function (event) {
                        var item = $(event.target).text();
                        $("#jqxWidget").jqxListBox("selectItem", item);
                    });
                });
            </script>
            <div id='jqxWidget'>
            </div>
        </div>
    </body>
    </html>

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.