How to Edit or Add a New Row in jqGrid

我怕爱的太早我们不能终老 提交于 2019-11-30 05:15:46
Oleg

First of all, you shouldn't call jqGrid('editGridRow',"new"...) in most cases. Instead of that you should have the user click an Add Record button. Then a dialog will appear with all fields which have editable=true in colModel.

After they click the Submit button, jqGrid will POST data to the URL defined by url parameter or editurl parameter (if it exists). Because you use parameter mtype='POST' for the data filling, you have to define additional editurl parameter. You can overwrite POST HTTP code to PUT or any other which you like.

It is important to understand that the id for new records has an _empty value. The Edit dialog works in the same way as the Add dialog, but includes the id of the modified record. As an additional important parameter which will be sent to the server in the case of add new record is additional parameter oper=add.

For more information read section What is posted to the server on http://www.trirand.com/jqgridwiki/doku.php?id=wiki:form_editing.

I recommend that you also read about different parameters sent by jqGrid in the description of prmNames parameter on http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!