jqGrid: how to copy a row?

2019-04-17 02:05发布

问题:

I'm using jqGrid PHP. When adding a new row (inline mode), how can I pre fill the new row using the same cell data with the last selected row? Thanks so much.

回答1:

You can use a global variable to get the values from last selected row in onSelectRow event like this.

var lastsel= jQuery('#grid').jqGrid('getGridParam','selrow');

Now while adding a new row you can use addRowData like this

$("#grid").addRowData(rowid,data, position, srcrowid);

where data, you can get from lastsel var.

See this for further reference.



标签: php jqgrid