Since: DataTables 1.10

Add multiple new rows to the table.


Adding new data to a table is central to the concept of being able to dynamically control the content of a DataTable, and this method provides the ability to do exactly that, adding multiple new rows at a time. If you wish to add only a single row at a time, this method's singular counterpart, row.add() can be used.

The rows that are added are subjected to the ordering and search criteria that are applied to the table, which will determine the new row's position and visibility in the table.

This method will add the data to the table internally, but does not visually update the tables display to account for this new data. In order to have the table's display updated, use the draw() method, which can be called simply as a chained method of the row.add() method's returned object - for example table.row.add( [ 1, 2, 3, 4 ] ).draw();. This is done to allow easy optimisation of the table where multiple rows can be added before the table is redrawn.


function rows.add( data )


Add new rows to the table using the data given


DataTables API instance with the newly added rows in its result set.


Add two new rows to the table and redraw:

var table = $('#example').DataTable();

table.rows.add( [ {
		"name":       "Tiger Nixon",
		"position":   "System Architect",
		"salary":     "$3,120",
		"start_date": "2011/04/25",
		"office":     "Edinburgh",
		"extn":       "5421"
    }, {
		"name": "Garrett Winters",
		"position": "Director",
		"salary": "$5,300",
		"start_date": "2011/07/25",
		"office": "Edinburgh",
		"extn": "8422"
	} ] )

Add multiple new instances of an object to a table and then add a class to those newly added rows:

var table = $('#example').DataTable();

	.rows.add( [
		new Pupil( 43 ),
		new Pupil( 67 ),
		new Pupil( 102 )
	] )
	.addClass( 'new' );


The following options are directly related and may also be useful in your application development.