jqGrid中添加一行数据

半城伤御伤魂 提交于 2020-02-21 11:32:17

addRowData

官方说明:

Method parameters Returns
addRowData rowid,data, position, srcrowid true on success, false otherwise

Description:

Inserts a new row with id = rowid containing the data in data (an object) at the position 
specified (first in the table, last in the table or before or after the row specified in srcrowid).
The syntax of the data object is: {name1:value1,name2: value2…} where name is the name of the 
column as described in the colModel and the value is the value. <br>This method can insert 
multiple rows at once. In this case the data parameter should be array defined as 
[{name1:value1,name2: value2…}, {name1:value1,name2: value2…} ] and the first option rowid should
contain the name from data object which should act as id of the row. It is not necessary that 
the name of the rowid in this case should be a part from colModel.

参数有4个,分别为,新插入的行的rowid,该行的数据(也可以一次性插入多行数据),插入数据的位置,这里通常有firstlastbeforeafter这几个选项,分别表示插到首,尾,前,后等位置.最后一个参数srcrowid是当position为beforeafter时,需要指定的参照rowid.
一般而言,我们都是直接插到尾端.

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