SMART datagrid v.1 > Classes > GridDataSet
Insert original data of one or more data rows which are transferred by rows array in row row location of data set, and return the number of rows which have been actually inserted.
If row is less than 0 or greater than rowCount, it will throw an exception. The data of each row which is contained in rows can be array or JSON object, and JSON object will be arranged and stored as array according to field order.
// If rowEvents is false, the event will be fired when inserting of all rows is committed.
ds.onRowsInserted = function (ds, row, count) {
console.log(row + '' + count + ' row has been inserted in th row location.';
};
// If rowEvents is true, the event will be fired whenever each row is inserted.
ds.onRowInserted = function (ds, row) {
console.log(row + 'One row has been inserted in th row location.';
};
// Each row which is transferred by function can be array or JSON object.
var rows = [
['value1', 'value2', 'value3', 111, 222],
{
'field1': 'value11',
'field2': 'value12',
'field3': 'value13',
'field4': 666,
'field5': 777
}
];
// If the count is -1, it will insert all rows of rows, and if it is greater than 0, it will insert as much as Math.min(count, rows.length).
var row = grid.focusedRowIndex();
ds.appendRows(row, rows, 0, -1, false);