SMART datagrid v.1 > Classes > GridDataSet

Back  Forward

DataLudi.GridDataSet.insertXmlRows  method

Except for transferring XML object to rows parameter, it is the same as insertRows

function insertXmlRows (row: Number, rows: XMLList, start: Number, count: Number, rowEvemts: Boolean): Integer;
Returns
Integer
Parameters
row - Number. required.
rows - XMLList. required.
start - Number. Defaults to 0.
count - Number. Defaults to -1.
rowEvemts - Boolean. Defaults to false.
If it is true, confirmation and completion events will be fired in row unit. If it is DataSet.undoable, events in row unit will not be fired regardless of this property.
Code -1
    // 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.';
    };
    
    // rows parameter is XML object.
    // 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 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;
    // Insert rows from the first row.
    ds.insertXmlRows(0, rows, 0, -1, false);
See Also
appendXmlRows
updateXmlRows
setXmlRows
insertRows
Examples
Grid Data Set Edit
Row Inserting