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,该行的数据(也可以一次性插入多行数据),插入数据的位置,这里通常有first
,last
,before
,after
这几个选项,分别表示插到首,尾,前,后等位置.最后一个参数srcrowid是当position为before
或after
时,需要指定的参照rowid.
一般而言,我们都是直接插到尾端.
$("#productList").addRowData(rowid, josnData, "last");
来源:CSDN
作者:leonardy
链接:https://blog.csdn.net/Leonardy/article/details/104417118