【JQGRID DOCUMENTATION】.学习笔记.5.Form Editing

JqGrid支持为view ,add, edit,delete, search创建一个on the fly的form。这使得Modal Boxes和行内编辑能够在程序用结合。毕竟,行内编辑只能用在已经存在的行,并且不用用来搜索,删除或添加数据。然而,不推荐同时使用Modal Boxes和行内编辑,因为当选中同一行时,他们会相互干扰。当你选择一行进行编辑中,点击了edit modal box,在box中会得到cell的id,而不是实际cell的数据内容。

1 软件安装必备

要使用这个module,需要jqModal和jqDnR插件的支持。总共需要grid.common.js,grid.formedit.js,jqModal.js,jqDnR.js的引用。

2 方法

所有方法的属性和事件都不是jqGrid的一部分,而是做参数的选项的一部分,它传递给了方法。

3 editGridRow

这个方法为编辑特定行,通过modal dialog创建一个form。这个方法使用Common Editing Properties。调用约定:

1 jQuery("#grid_id").editGridRow( rowid, properties );
2 or when we use the new API
3 jQuery("#grid_id").jqGrid('editGridRow', rowid, properties );

properties:是一个name:value对的数组,包含下面的属性和事件。要改变,可以在语言文件中。

1 $.jgrid = {
2 ...
3 edit : {
4 addCaption: "Add Record",
5 editCaption: "Edit Record",
6 bSubmit: "Submit",
7 bCancel: "Cancel",
8 bClose: "Close",
9 saveData: "Data has been changed! Save changes?",
10 bYes : "Yes",
11 bNo : "No",
12 bExit : "Cancel",
13 ...
14 },
15 ...
16 }
原文地址:https://www.cnblogs.com/msdynax/p/3313983.html