Home > Article > Web Front-end > jqGrid cell content modification_change cell value_setCell
When using the jqgrid data table, sometimes you need to modify the content of the cell directly in the interface and edit the cell
The following is an introduction to the method of modifying the cell
jQuery("#user-list").setCell(3, 'name', 'cht');
Another writing method
jQuery("#user-list").jqGrid('setCell',3, 'name', 'ddd');
setCell parameter description:
rowid, row number
colname, name attribute in colNames
data, the value to be modified
class, add style
If you encounter the situation where setCell is not easy to use (has no effect), you need to pay attention to
id, and use the rowid in gqgrid
If the cell uses formatter to format data, you need to pay attention to setCell The data value in setCell also needs to match it. For example,
colModel : [ { label : 'name', name : 'name', index : 'name', formatter : function(cellValue) { if (cellValue == 1) { return "Yes" } else { return "No"; } return ''; } } ]
If you want the cell to display Yes, the data in setCell needs to be written as 1 as follows:
jQuery("#user-list").setCell(3, 'name', '1');
The above is jqGrid cell content modification_ Change the content of cell value_setCell. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!