jQWidgets Forums

jQuery UI Widgets Forums General Discussions Lists DropDownList Problem to populated dropdownList with json data

This topic contains 3 replies, has 2 voices, and was last updated by  nico86 10 years, 10 months ago.

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

  • nico86
    Participant

    Hi,
    I try to populated a dropdown List with ajax request and json datatype but it doesn’t work, could you help me.

    my data return is like this :
    [URL=http://www..com/i/140930013119707827.jpg][IcasimagesMG]http://nsa33.casimages.com/img/2014/09/30/mini_140930013119707827.jpg[/IMG][/url]

    	complete :function(data){
    		var resu= eval(data);  
    		
                    var source =
                    {
                        datatype: "json",
                        datafields: [
                            { name: 'LLT' }
                             ],
                         id: 'id',
    		 localdata: resu
                    };
    				
                    var dataAdapter = new $.jqx.dataAdapter(source);
                    $("#jqxWidget").jqxListBox({ source: dataAdapter, width: 300, height: 350,checkboxes: true });
                    $("#jqxWidget").on('checkChange', function (event) {
                        var args = event.args;
                        if (args.checked) {
                            $("#Events").text("Checked: " + args.label);
                        }
                        else {
                            $("#Events").text("Unchecked: " + args.label);
                        }
                        var items = $("#jqxWidget").jqxListBox('getCheckedItems');
                        var checkedItems = "";
                        $.each(items, function (index) {
                            if (index < items.length - 1) {
                                checkedItems += this.label + ", ";
                            }
                            else checkedItems += this.label;
                        });
                        $("#CheckedItems").text(checkedItems);
    				});
    

    Thanks.

    Nicolas.


    nico86
    Participant

    my data return from ajax request are like this (i try with or without id)

    stocker des photos

    thanks


    Dimitar
    Participant

    Hello Nicolas,

    Could you, please, provide us with your complete page code (including the script references) and some sample data? Remember to format your code by selecting it and pressing the code button in the toolbar.

    Best Regards,
    Dimitar

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


    nico86
    Participant

    I resolved my problem adding displaymember, sorry
    $(“#jqxWidget”).jqxListBox({ source: dataAdapter, displayMember: “LLT”, width: 300, height: 350, checkboxes: true });

    have a nive day

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

You must be logged in to reply to this topic.