Since: DataTables 1.10

Add a new row 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. It will add a single row at a time - for addition of multiple rows, either call this method multiple times, or use this method's plural counterpart: rows.add().

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 row.add( data )


Add a new row to the table using the given data


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


Simply add a new row to the table and redraw:

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

table.row.add( {
		"name":       "Tiger Nixon",
		"position":   "System Architect",
		"salary":     "$3,120",
		"start_date": "2011/04/25",
		"office":     "Edinburgh",
		"extn":       "5421"
	} ).draw();

Add a row and get its newly created node to highlight that it was newly added:

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

var rowNode = table
	.row.add( [ 'Fiona White', 32, 'Edinburgh' ] )

$( rowNode )
	.css( 'color', 'red' )
	.animate( { color: 'black' } );


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