jQWidgets Forums

jQuery UI Widgets Forums Grid Getting display and value from dd inside grid

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 12 years, 3 months ago.

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

  • willgoldring
    Member

    I have a dropdown field that uses a source that suplies both a display name and a value (ID). How can I fetch them upon an update/edit?

    Upon ‘cellendedit, I need to fetch the value (ID) for the displayed name…..

    Thanks!!

    p.s. the event.args does not include an .item property so cannot see the display name AND the value.

    the grid column looks like:

    { text: ‘Client’, datafield: ‘client’, columntype: ‘dropdownlist’, filtertype: ‘checkedlist’, cellsalign: ‘left’, width: 150,
    createeditor: function (row, column, editor) {
    editor.jqxDropDownList({ source: clients, displayMember: “client”, valueMember: “clientID” });
    }

    and the update routine:

    $(“#jqxgrid”).bind(‘cellendedit’, function (event) {
    var args = event.args;

    $(“#cellendeditevent”).html(“Event Type: cellendedit, Column: ” + args.datafield + “, Row: ” + (1 + args.rowindex) + “, Value: ” + args.value);
    var id = $(“#jqxgrid”).jqxGrid(‘getcellvalue’, event.args.rowindex, ‘donationID’);

    $.ajax({
    url: “DataProvider.aspx”,
    dataType: ‘json’,
    data: { ‘fn’: ‘updateDonation’, ‘donationID’: id, ‘column’: args.datafield, ‘value’: args.value },
    async: false,
    success: function (json) {
    donations = json;
    }

    });

    });


    Peter Stoev
    Keymaster

    Hi willgoldring,

    I suggest you to take a look at the implementation of this sample: gridkeyvaluecolumn.htm. It shows how to get the cell’s label and value.

    Best Regards,
    Peter Stoev

    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.