jQWidgets Forums

jQuery UI Widgets Forums Lists DropDownList jqxDropDownList(‘getItems’) not working

Tagged: 

This topic contains 3 replies, has 2 voices, and was last updated by  Peter Stoev 11 years, 7 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • jqxDropDownList(‘getItems’) not working #33191

    supun151515
    Participant

    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 Silva


    Peter Stoev
    Keymaster

    Hi 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 Stoev

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


    supun151515
    Participant

    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 Silva


    Peter Stoev
    Keymaster

    Hi Supun Silva,

    I suggest you to look at the “getItems” method in the API documentation.

    Best Regards,
    Peter Stoev

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

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

You must be logged in to reply to this topic.