Adds a record or records to the grid.
add(record, [first])

record | object or array, record(s) to add
first | boolean, optional, indicates that record/s would be added to first

Returns integer.

#### Description

Adds a record or records to the grid by adding them into the .records array and calling the .refresh() method. The first argument record is the record object or an array of record objects. If you add multiple records at a time, it will only refresh the grid after all of them were added. Setting the second argument first to true, the records would be added to first line. By default records are inserted to the end of the grid.
Returns the number of records it adds.
If you define grid as: $('#grid').w2grid({ name : 'grid', columns: [ { field: 'recid', caption: 'ID', size: '50px' }, { field: 'lname', caption: 'Last Name', size: '30%' }, { field: 'fname', caption: 'First Name', size: '30%' }, { field: 'email', caption: 'Email', size: '40%' }, { field: 'sdate', caption: 'End Date', size: '120px' } ], records: [ { recid: 1, fname: 'John', lname: 'doe', email: 'vitali@gmail.com', sdate: '1/3/2012' }, { recid: 2, fname: 'Stuart', lname: 'Motzart', email: 'jdoe@gmail.com', sdate: '2/4/2012' } ] }); You can add records by: w2ui['grid'].add({ recid: 3, fname: 'Jin', lname: 'Franson', email: '--', sdate: '4/23/2012' }); or several at a time: w2ui['grid'].add([ { recid: 4, fname: 'Susan', lname: 'Ottie', email: 'jdoe@gmail.com', sdate: '5/3/2012' }, { recid: 5, fname: 'Kelly', lname: 'Silver', email: 'jdoe@gmail.com', sdate: '4/3/2012' }, { recid: 6, fname: 'Francis', lname: 'Gatos', email: 'vitali@gmail.com', sdate: '2/5/2012' } ]); See .records array for the structure of the record object.