jQWidgets Forums

jQuery UI Widgets Forums Grid Getting a recordID when using singlecell

This topic contains 2 replies, has 2 voices, and was last updated by  DavidSimmons 12 years, 7 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Getting a recordID when using singlecell #8763

    DavidSimmons
    Participant

    I am using selectionmode: “singlecell” and it works great, but in need to get the value of column ID each time I edit a cell to pass to my ajax update. What is the best way to do this?

    var datarowid = ************;

    var source = {
    datatype: “json”,
    datafields: [
    { name: ‘ID’ },
    { name: ‘AppName’ },
    { name: ‘Created’ },
    { name: ‘CreatedBy’ },
    { name: ‘Updated’ },
    { name: ‘UpdatedBy’ }
    ],
    url: “indexData.php”
    };

    var dataAdapter = new $.jqx.dataAdapter(source);

    $(“#jqxgrid”).jqxGrid(
    {
    width: 1000,
    source: dataAdapter,
    theme: theme,
    columnsresize: true,
    editable: true,
    selectionmode: “singlecell”,
    columns: [
    { text: ‘ID’, dataField: ‘ID’, width: 100 },
    { text: ‘AppName’, dataField: ‘AppName’, width: 200 },
    { text: ‘Created’, dataField: ‘Created’, width: 160 },
    { text: ‘CreatedBy’, dataField: ‘CreatedBy’, width: 160 },
    { text: ‘Updated’, dataField: ‘Updated’, width: 160 },
    { text: ‘UpdatedBy’, dataField: ‘UpdatedBy’, width: 160 }
    ]
    });

    $(“#jqxgrid”).bind(‘cellvaluechanged’, function (event) {
    var column = args.datafield;
    var row = args.rowindex;
    var value = args.newvalue;
    var oldvalue = args.oldvalue;

    var datarowid = ************;

    $(“#cellendeditevent”).html(“Event Type: cellvaluechanged, Column: ” + args.datafield + “, Row: ” + (1 + args.rowindex) + “, Value: ” + args.newvalue);

    });

    Getting a recordID when using singlecell #8813

    Dimitar
    Participant

    Hello DavidSimmons,

    Here is how to get the value of the cell in column ID. Add this to your ‘cellvaluechanged’ event function:

                var cellValueID = $('#jqxgrid').jqxGrid('getrowdata', row).ID;

    Best Regards,
    Dimitar

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

    Getting a recordID when using singlecell #8870

    DavidSimmons
    Participant

    Got it, thanks…

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

You must be logged in to reply to this topic.