searchBuilder.rebuild()
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 object
in the same structure as is returned from searchBuilder.getDetails()
, it is also of the same structure as searchBuilder.preDefined
and that page is where the structure of the object is documented. It contains all of the details required to reconstruct SearchBuilder to a complex search. If no argument is given, the search will be cleared.
Type
function searchBuilder.rebuild( state )
- Description:
Rebuilds the search to be the same as that provided by the
details
parameter.- Parameters:
Name Type Optional 1 state
No Object of the same structure as returned by
searchBuilder.getDetails()
. For more details on the structure, read the documentation onsearchBuilder.preDefined
- Returns:
DataTables API instance
Example
Get the details of a Search::
var stored;
$('#example').DataTable( {
dom: 'Qlfrtip'
});
$('#getDetails').on('click', function() {
stored = $('#example').DataTable().searchBuilder.getDetails();
})
$('#revert').on('click', function() {
$('#example').DataTable().searchBuilder.rebuild(stored);
})
Related
The following options are directly related and may also be useful in your application development.