jQWidgets Forums

jQuery UI Widgets Forums Grid jqxDropDownList in jqxGrid

This topic contains 6 replies, has 2 voices, and was last updated by  btpy 12 years, 1 month ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • jqxDropDownList in jqxGrid #17455

    btpy
    Member

    Hello!
    I’m having some troubles with getting values of DropDownList,
    after initializing it as shown in the demo:
    {
    text: ‘textField’, datafield: ‘Name’, displayfield: Name’, columntype: ‘dropdownlist’,
    createeditor: function (row, value, editor) {
    editor.jqxDropDownList({ source: worksAdapter, displayMember: ‘label’, valueMember: ‘value’ });
    }, width:600
    },

    I’m trying to get values from grid with .jqxGrid(‘getRows’).
    But I just don’t know how to deal with values of DropDownList, because i get only labels

    jqxDropDownList in jqxGrid #17457

    Peter Stoev
    Keymaster

    Hi btpy,

    You can see this sample: gridkeyvaluescolumnwitharray.htm.

    And also: gridkeyvaluecolumn.htm.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    jqxDropDownList in jqxGrid #17459

    btpy
    Member

    As for now I can only see the way out in making extra arrays and merging them or smth like that, but seems to me, that would be overkill.
    Isn’t there a method to get both params from ‘getRows’?
    or even only value

    jqxDropDownList in jqxGrid #17460

    Peter Stoev
    Keymaster

    Hi btpy,

    getrows returns the Grid rows. If your row has “label” and “value” members then the jqxDropDownList will have label and value. That is because in the posted code you have specified that the displayMember is ‘label’ and valueMember is ‘value’.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    jqxDropDownList in jqxGrid #17464

    btpy
    Member

    I apologize if I’m understanding you wrong,
    but when take this:
    {
    editor.jqxDropDownList({ source: worksAdapter, displayMember: ‘label’, valueMember: ‘value’ });
    }, width:600
    and try to change displayMember and valueMember different ways, i get the same ‘getRows’ Array. In fact – the same select output in the grid

    jqxDropDownList in jqxGrid #17465

    Peter Stoev
    Keymaster

    Hi btpy,

    Ok, what is worksAdapter? It it the same adapter that you use for the Grid? If it is the same, then it is not necessary to use “createeditor” at all, because it automatically binds the DropDownList.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    jqxDropDownList in jqxGrid #17467

    btpy
    Member

    Oh, no.
    grid uses one adapter and List – another:

    var worksSource =
    {
    datatype: “json”,
    data: {“contractId”: contractId},
    datafields: [
    { name: ‘label’, type: ‘string’ },
    { name: ‘value’, type: ‘string’ }
    ],
    url: ‘/state/works/’
    };
    var worksAdapter = new $.jqx.dataAdapter(worksSource, {
    loadComplete: function () {
    // get data records.
    var records = dataAdapter.records;
    }
    });

    var source =
    {
    datatype: “json”,
    data: {“actId”: actId, “contractId”: contractId},
    datafields: [
    { name: ‘Act_Work_ID’ },
    { name: ‘Act_ID’ },
    { name: ‘Act_Work_Percent’ },
    { name: ‘Act_Work_Base_Price’ },
    { name: ‘Act_Work_Full_Price’ },
    { name: ‘Contract_Work_Name’ }
    ],
    url: ‘/state/workstable/’

    };

    var dataAdapter = new $.jqx.dataAdapter(source, {
    loadComplete: function () {
    // get data records.
    var records = dataAdapter.records;

    }
    });
    // initialize jqxGrid
    $(“#jqxgrid”).jqxGrid(
    {
    … the same code

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

You must be logged in to reply to this topic.