jQuery UI Widgets › Forums › General Discussions › Lists › DropDownList › jqxDropDownList(‘getItems’) not working
Tagged: getItems
This topic contains 3 replies, has 2 voices, and was last updated by Peter Stoev 12 years, 2 months ago.
-
Author
-
I have tried to get $(“#combo_project_list_body”).jqxDropDownList(‘getItems’);
But it retrieved values [object Object],[object Object],[object Object]
I want to get Item count and values in a array.Below is my codes. php wokes fine and gets data into dropdown list.
$(“#testbtn”).on(“click”, function(){
var project_list = $(“#combo_project_list_body”).jqxDropDownList(‘getItems’);
alert(project_list);});
I have three records in database;
this is my jquery;$(document).ready(function () {
var theme = “”;
var url = “../jquery/php/combo_project_list.php”;
// prepare the data
var source =
{
datatype: “json”,
datafields: [
{ name: ‘p_no’ },
{ name: ‘p_name’},
{ name: ‘client_id’},
{ name: ‘reg_date’},
{ name: ‘end_date’}],
url: url,
async: false
};
var dataAdapter = new $.jqx.dataAdapter(source);
// Create a jqxDropDownList
$(“#combo_project_list_head”).jqxDropDownList({
selectedIndex: 0, source: dataAdapter, displayMember: “p_no”, valueMember: “p_no”, width: 100, height: 18, theme: theme
});
$(“#combo_project_list_head”).jqxDropDownList({ autoDropDownHeight: true });
});and PHP as below;
Thank You,
Supun SilvaHi supun151515,
“getItems” returns exactly that – an Array of Items and each Item is an Object so in general it returns an Array of Objects where each object has members like “label” and “value”. “label” is the display text and “value” is the value associated to the item.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi.. Thanks for your reply. I did not get any value. It is not receiving any value. only i get object Object. Kindly help me to get label, value for each item.
Thank you,
Supun SilvaHi Supun Silva,
I suggest you to look at the “getItems” method in the API documentation.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.