jQWidgets Forums
jQuery UI Widgets › Forums › General Discussions › Lists › DropDownList › Problem to populated dropdownList with json data
Tagged: ajax, bind, DropDownList, initialize, jqxDropDownList, json
This topic contains 3 replies, has 2 voices, and was last updated by nico86 10 years, 10 months ago.
-
Author
-
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.
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,
DimitarjQWidgets team
http://www.jqwidgets.com/I resolved my problem adding displaymember, sorry
$(“#jqxWidget”).jqxListBox({ source: dataAdapter, displayMember: “LLT”, width: 300, height: 350, checkboxes: true });have a nive day
-
AuthorPosts
You must be logged in to reply to this topic.