开发者

On row click column value has to be changed in jqgrid

开发者 https://www.devze.com 2023-01-28 12:10 出处:网络
I have a jqGrid with four columns and in which i get the rows from the database. Now i want some thing like this. On row selection the cell value of row has to be changed.

I have a jqGrid with four columns and in which i get the rows from the database. Now i want some thing like this. On row selection the cell value of row has to be changed.

i.e.

 SNo       SName      Update     Roll No
  1        Steve      Rename      1001
  2         Jack      Rename      1002

I want to update 开发者_如何学Gothe SName when the user selects Rename from jqGrid row for example if the user selectes rename from first row then first row should be like the following

i.e.

SNo       SName        Update         Roll No
 1        Steve     Update/Cancel      1001
 2        Jack         Rename          1002

Can any one suggest me how to obtain the same


It seems to me that you try to make things more complex as it is. Why do you not use the standard behavior of the jqGrid "inline editing"?

If user double-click (or click depend on your requirements) on the row the "editable" columns of the row can be modified (see old answer for more information). If the user end the row editing with pressing of "Enter" key the changed will be saved. If the user press "Esc" key or select another row the changes will be discarded. So the standard inline editing supports rename/update/cancel without additional "update" column.

If you want have a buttons in an additional column you can use formatter:"actions" or use "custom editing" technique which you can see on the jqGrid demo if you select "Row Editing" / "Custom Edit".

0

精彩评论

暂无评论...
验证码 换一张
取 消