jQuery UI Widgets Forums Lists ComboBox Remote Data Bind Noob

This topic contains 2 replies, has 2 voices, and was last updated by  Dimitar 8 years, 11 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Remote Data Bind Noob #80267

    4xjbh
    Participant

    I have a route in laravel configured and it returning a collection of contacts in json when I type in the url noted in the code below but when I try to do a remote load the combobox renders correctly but there is no data in the selection.

    What have I done incorrectly?

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html lang="en">
    <head>
        <title>Getting Started</title>
    
        <link rel="stylesheet" href="../jqwidgets/styles/jqx.base.css" type="text/css" />
        <link rel="stylesheet" href="../jqwidgets/styles/jqx.darkblue.css" type="text/css" />
    
        <script type="text/javascript" src="../jqwidgets/scripts/jquery-1.11.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/jqxcombobox.js"></script>
        <script type="text/javascript" src="../jqwidgets/jqxlistbox.js"></script>
        <script type="text/javascript" src="../jqwidgets/jqxbuttons.js"></script>
        <script type="text/javascript" src="../jqwidgets/jqxscrollbar.js"></script>
    
    </head>
    <body>
    
        <div id='jqxcombobox'>
    
            <script type="text/javascript">
    
                $(document).ready(function () {
    
                    var source =
                    {
                        datatype: "jsonp",
                        datafields: [
                            { name: 'first' },
                            { name: 'last' }
    
                        ],
                        url: "http://localhost:8000/project/jqcontact",
                        data: {
                            style: "full",
                            maxRows: 50
                        }
                    };
                    var dataAdapter = new $.jqx.dataAdapter(source);
    
                    // Create a jqxComboBox
                    $("#jqxcombobox").jqxComboBox(
                            {
                                width: 200,
                                height: 25,
                                source: dataAdapter,
                                selectedIndex: 0,
                                displayMember: "first",
                                valueMember: "id"
                            });
                });
            </script>
    </body>
    </html>
    Remote Data Bind Noob #80272

    4xjbh
    Participant

    Should be “datatype: “json”

    Remote Data Bind Noob #80299

    Dimitar
    Participant

    Hello 4xjbh,

    Is your issue fixed by setting datatype: "json"?

    Best Regards,
    Dimitar

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

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

You must be logged in to reply to this topic.