row().child().hide()
Hide child rows after creating new child rows.
Description
This method can be used to make the child rows of a parent row hidden at any time. When child row(s) are set as hidden they are not detached from the parent row, but rather simply not drawn on the page. This method provides a way of hiding a row at any required time.
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 = new DataTable('#myTable');
// 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();