How to Edit or Add a New Row in jqGrid

前端 未结 1 1602
误落风尘
误落风尘 2020-12-29 11:19

My jqGrid that does a great job of pulling data from my database, but I\'m having trouble understanding how the Add New Row functionality works.

Right now, I\'m able

相关标签:
1条回答
  • 2020-12-29 12:12

    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

    0 讨论(0)
提交回复
热议问题