SMART datagrid v.1 > Classes > GridDataSet
除了向rows参数传递XML对象之外,与insertRows是相同的。
// 如果rowEvents为false,就会在提交所有行的插入时,触发事件。
ds.onRowsInserted = function (ds, row, count) {
console.log(row + '已在第 个行位置,插入' + count + '行。';
};
// 如果rowEvents为true,就会在每次插入各个行时,触发事件。
ds.onRowInserted = function (ds, row) {
console.log(row + '已在第 个行位置,插入一个行。';
};
// rows参数是XML对象。
// 如果count为-1,就会插入rows的所有行,而如果大于0,就会插入相当于Math.min(count, rows.length)的数量。
//|
|
var rows = '<rows><row id="1" userid="smccoy" company="Fivespan" first_name="Jane"/><row id="2" userid="smccoy" company="Fivespan" first_name="Jane"/></rows>';
rows = DataLudi.parseXml(rows).documentElement.childNodes;
// 从第一个行开始,插入rows。
ds.insertXmlRows(0, rows, 0, -1, false);