jQWidgets Forums

jQuery UI Widgets Forums Grid editor.jqxDropDownList: Saveing valueMember instead of displayMember

This topic contains 1 reply, has 2 voices, and was last updated by  Dimitar 12 years, 1 month ago.

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

  • hf
    Participant

    Hello,

    I’m using the jqxGrid to display and edit data. By one of the columns I loaded data from another table which will be displayed by editing. I would like to save the valuemember instead of the displaymember.

    { text: ‘Test’, datafield: ‘test’, columntype: ‘dropdownlist’, filtertype: ‘checkedlist’, editable: true,
    createeditor: function (row, column, editor) {
    // assign a new data source to the dropdownlist.
    editor.jqxDropDownList({ source: arrayICG, displayMember: ‘naam’, valueMember: ‘id’ });
    },
    // update the editor’s value before saving it.
    cellvaluechanging: function (row, column, columntype, oldvalue, newvalue) {
    // return the old value, if the new value is empty.
    if (newvalue == “”) return oldvalue;
    }
    },

    This is how my updaterow defined in the source looks like:

    updaterow: function (rowid, rowdata, commit) {
    // synchronize with the server – send update command
    // call commit with parameter true if the synchronization with the server is successful
    // and with parameter false if the synchronization failder.

    var data = {
    row_id: rowdata.id,
    g_naam: rowdata.g_naam,
    icg: rowdata.test
    };

    var jsonData = JSON.stringify(data);
    $.ajax({
    type: ‘POST’,
    contentType: ‘application/json; charset=utf-8’,
    dataType: ‘json’,
    url: ‘WebService1.asmx/updateICG’,
    cache: false,
    data: jsonData,
    success: function (data, status, xhr) {
    if (data.d.indexOf(‘||_ERROR_||’) == -1) {
    commit(true);
    }
    else {
    commit(false);
    errorHandler(data.d.replace(“||_ERROR_||”, “”));
    }
    },
    error: function (jqXHR, textStatus, errorThrown) {
    alert(errorThrown);
    commit(false);
    }
    });

    commit(true);

    Any help would be appreciated.

    Regards


    Dimitar
    Participant

    Hello hf,

    The only value that can be displayed is that of the displayMember. However, you can still access the value of the valueMember as shown in the demo Keys/Values Column (note the first column in the example).

    Best Regards,
    Dimitar

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

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

You must be logged in to reply to this topic.