{hero}

searchBuilder.rebuild()

Since: SearchBuilder 1.0.0

Rebuild the search to a given state.
Please note - this property requires the SearchBuilder extension for DataTables.

Description

This method provides the ability to set the search in SearchBuilder.

searchBuilder.rebuild() takes one argument, it is an SearchBuilder.Criteria object which defines the search logic to be applied.

If no argument is given, the search will be cleared.

Type

function searchBuilder.rebuild( [state, [redraw]] )

Description:

Rebuilds the search to be the same as that provided by the details parameter.

Parameters:
Returns:

DataTables API instance

Example

Get the details of a Search::

var stored;
var table = new DataTable('#myTable', {
	layout: {
		top1: 'searchBuilder'
	}
});

$('#getDetails').on('click', function () {
	stored = table.searchBuilder.getDetails();
});

$('#revert').on('click', function () {
	table.searchBuilder.rebuild(stored);
});

Related

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