Methods

For inline editing, we have three additional methods (of the Grid API) available:

These methods can be called, of course, only on an already-constructed grid, from a button click or from an event of the grid itself:

onSelectRow: function(id){ if(id && id!==lastSel){ jQuery('#tbleditable').restoreRow(lastSel); lastSel=id; } jQuery('#tbleditable').editRow(id, true); },

In this example, if another was row being edited and has not yet been saved, the original data will be restored and the row "closed" before "opening" the currently-selected row for editing (where lastSel was previously defined as a var).

editRow

Calling convention:

editRow(rowid, keys, oneditfunc, succesfunc, url, extraparam, aftersavefunc, onerrorfunc)

where


If keys is true, then the remaining settings -- succesfunc, url, extraparam, aftersavefunc and onerrorfunc -- are passed as parameters to the saveRow method when the [Enter] key is pressed (saveRow does not need to be defined as jqGrid calls it automatically). For more information see saveRow method below.

When this method is called on particular row, jqGrid reads the data for the editable fields and constructs the appropriate elements defined in edittype and editoptions.

saveRow

Calling convention:
saveRow (rowid, succesfunc, url, extraparam, aftersavefunc, onerrorfunc)

where

Except when url (or editurl) is 'clientArray', when this method is called, the data from the particular row is POSTED to the server in format name: value, where the name is a name from colModel and the value is the new value. jqGrid also adds, to the posted data, the pair id: rowid. For example,

jQuery("#grid_id").saveRow("rowid", false);
will save the data to the grid and to the server, while
jQuery("#grid_id").saveRow("rowid", false, 'clientArray');
will save the data to the grid without an ajax call to the server.

restoreRow

Calling convention:
restoreRow(rowid)

where

This method restores the data to original values before the editing of the row.


  Last Updated: 2/15/2009 | © Tony's jqGrid - a jQuery Plugin, 2010