Search This Blog

Monday, 4 March 2013

Change cell value in jqGrid


To change the value of a cell in a jqGrid, you can use the setCell method provided by jqGrid. 
Here’s how you can do it:

Syntax:

$("#grid").jqGrid('setCell', rowid, columnname, value, cssclass, properties)

Parameters:

  • rowid: The ID of the row where the cell is located.
  • columnname: The name of the column (the name property from the colModel).
  • value: The new value to set in the cell.
  • cssclass: (Optional) A class to apply to the cell.
  • properties: (Optional) An object containing any additional properties to set on the cell.

  • Examples:
    ----- ---------- ---------- ---------- ---------- ---------- ----------
        
         $("#gridId").jqGrid('setCell', rowId,'qty', '12345');          

    ----- ---------- ---------- ---------- ---------- ---------- ----------
                                                OR
    ----- ---------- ---------- ---------- ---------- ---------- ----------
     
        var rowData = $('#gridId').jqGrid('getRowData', rowId);
        rowData.qty = '12321';
        $('#gridId').jqGrid('setRowData', rowId, rowData);

    ----- ---------- ---------- ---------- ---------- ---------- ----------

    No comments:

    Post a Comment