jQWidgets Forums

jQuery UI Widgets Forums General Discussions Lists DropDownList Dropdown | bindingcomplete is not working

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 11 years, 11 months ago.

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

  • rskbuvan
    Spectator

    Hi,

    Dropdown list bindingcomplete method is not getting triggered alike for grid.

    $(".company_select").on('bindingcomplete', function(event){ 
    $(".company_select").jqxDropDownList('selectIndex', 2);
    });

    .company_select = This is the class name given to the drop down list.

    so after binding complete, I want to select some index by default.

    Can anyone suggest me?

    Thanks & Cheers,
    \_rssb


    Peter Stoev
    Keymaster

    Hi,

    The event’s name is bindingComplete. Please, look at the API Docs, before using a specific API.

    <!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>
    <meta name="keywords" content="jQuery DropDownList, List, DropDownList, Popup List, jqxDropDownList, jqxListBox, List Widget, ListBox Widget, DropDownList Widget" />
    <meta name="description" content="In this demo the ComboBox is bound to JSON data" />
    <title id='Description'>In this demo the DropDownList is bound to JSON data.</title>
    <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.1.min.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxdata.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>
    <script type="text/javascript" src="../../jqwidgets/jqxdropdownlist.js"></script>
    </head>
    <body>
    <div id='content'>
    <script type="text/javascript">
    $(document).ready(function () {
    var theme = getDemoTheme();
    var url = "../sampledata/customers.txt";
    // prepare the data
    var source =
    {
    datatype: "json",
    datafields: [
    { name: 'CompanyName' },
    { name: 'ContactName' }
    ],
    url: url,
    async: false
    };
    var dataAdapter = new $.jqx.dataAdapter(source);
    $("#jqxWidget").on('bindingComplete', function (event) {
    alert('binding completed!');
    });
    // Create a jqxDropDownList
    $("#jqxWidget").jqxDropDownList({
    selectedIndex: 0, source: dataAdapter, displayMember: "ContactName", valueMember: "CompanyName", width: 200, height: 25, theme: theme
    });
    // subscribe to the select event.
    $("#jqxWidget").on('select', function (event) {
    if (event.args) {
    var item = event.args.item;
    if (item) {
    var valueelement = $("<div></div>");
    valueelement.text("Value: " + item.value);
    var labelelement = $("<div></div>");
    labelelement.text("Label: " + item.label);
    $("#selectionlog").children().remove();
    $("#selectionlog").append(labelelement);
    $("#selectionlog").append(valueelement);
    }
    }
    });
    });
    </script>
    <div id='jqxWidget'>
    </div>
    <div style="font-size: 12px; font-family: Verdana;" id="selectionlog">
    </div>
    </div>
    </body>
    </html>

    Best Regards,
    Peter Stoev

    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.