row().child().hide()

Since: DataTables 1.10

Hide child rows after creating new child rows.

Description

The row().child() method, when used to set the child row's data, will retain the state of the child row visibility. So if the parent row's children are visible, they will continue to be so after setting use row().child() to set a new value. This method provides a chaining option to quickly and easily hide the child rows after setting the new child row data.

Please note that this method is only available when row().child() is called with a parameter set. This is because row().child() will return the child rows if called with no parameters, which is either a jQuery object or undefined. When called with a parameter row().child() returns a DataTables.Api instance. If you need to hide a child row without any parameters being set use row().child.hide().

It is worth saying that this method is probably of limited use, but it is included in the API for completeness!

Unlike many of the other methods which manipulate the DataTable, this method does not require draw() to be called for the resulting change to be displayed. The child row(s) are inserted into the table without requiring that DataTables redraw.

Type

function row().child().hide()

Description:

Hide the child row(s) of a parent row

Returns:

DataTables API instance.

Example

Hide a child row immediately after setting its value:

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

// Show an initial child row
table
	.row( ':eq(0)' )
	.child( 'Extra information...' )
	.show();

// Change the information and hide - without the hide() call the changed
// information would be visible due to the show() above.
table
	.row( ':eq(0)' )
	.child( 'Different information' )
	.hide()