Kavitha
Kavitha

Reputation: 147

How to restore the row with cell values in inlinenav jqgrid

It is possible to restore the row of inlinenav jqgrid with my own cell values(hard coded values) as we do restore row with rowId like, $(#grid).jqgrid("restoreRow", rowId);

I have a row with three columns, i want to restore my row with my own cell data. Is there any way to do so?

Please help me achieve this. Thanks.

Upvotes: 2

Views: 1398

Answers (1)

Oleg
Oleg

Reputation: 221997

jqGrid saves the current editable value in savedRow parameter. During working of restoreRow jqGrid uses the values: it calls setRowData with the saved value.

You wrote that you use inlineNav. It means that you don't call the method restoreRow directly. Instead on that jqGrid calls restoreRow if the user select another row or press Esc key. To be able to modify the standard behavior of restoreRow you have to use callbacks/events, which jqGrid calls/triggers during processing of restoreRow. Thus it's important to know which version of jqGrid you use (can use) and from which fork of jqGrid because the set of callbacks/events and the exact behavior depend on the fork and the version used. I develop free jqGrid fork and recommend you to use it.

The method restoreRow supports beforeCancelRow and afterrestorefunc callbacks, which you can use to solve your problem. You can change some properties of savedRow inside of beforeCancelRow to solve your problem. Alternatively you can just make one more call of setRowData inside of afterrestorefunc to set the column value of restored row to the value, which you want to have. The exact specifying of beforeCancelRow or afterrestorefunc callbacks in inlineNav depends on the version/fork of jqGrid. You should post the information if you would have implementation problem based on my above description.

Upvotes: 2

Related Questions