SearchBuilder

SearchBuilder adds user defined complex search to the DataTable with the capability to search the DataTable by creating groups and conditions. This offers more advanced search controls than is currently offered by SearchPanes or the core DataTables functionality. It is possible to set logic types for groups and apply a variety of conditions.

SearchBuilder allows users to construct a search query by adding groups and conditions to a graphical interface that is clear and easy to follow. Already built in to SearchBuilder is a series of conditions that can be applied to all of the data types recognisable by DataTables. SearchBuilder automatically recognises the column type and presents the conditions that are available for it. These, of course, are all fully customisable to fit your needs and can be extended for custom types as required.

Download

The easiest way to get and use SearchBuilder is to use the DataTables download builder where you can select the software that you wish to use on your page and have a single Javascript and CSS file created and hosted for you. As well as choosing the SearchBuilder package, you also have to add the dependent DateTime package.

Alternatively, the individual files can be included on your page, a release package downloaded or the source control repository cloned on GitHub.

Initialisation

If you include the SearchBuilder extension on your page, it is automatically available for every DataTable on that page. You can customise SearchBuilder's location and configure it through the searchBuilder feature and the DataTables layout option.

// Simple initialisation:
new DataTable('#myTable', {
    layout: {
        topStart: 'searchBuilder'
    }
});

// Or, with configuration options:
new DataTable('#myTable', {
    layout: {
        topStart: {
            searchBuilder: {
                // config options here
            }
        }
    }
});

The simple initialisation will automatically enable SearchBuilder on your table. Some of the customisation options include: predefined searches, depth limits, column restrictions and default logic for groups. Please refer to the reference documentation for full details of the options available.

Note that it is also possible to configure SearchBuilder through the top level searchBuilder option.

Legacy dom option

If you are working with DataTables 1.x code, you might see the dom parameter being used, which uses an ASCII string to define where to put the table control elements. The letter for SearchBuilder is Q - e.g.:

$('#myTable').DataTable({
    dom: 'Qftip',
    searchBuilder:{
        // Your config here...
    },
});

This will still work with DataTables 2 (but not as the same time as layout - they are mutually exclusive), but it is recommended that you update to use layout.

Features

SearchBuilder adds the following features:

  • More searching functionality
  • Complex searching across multiple columns at once
  • Easily changeable logic operators
  • Custom conditions
  • Fully internationalisable
  • Full integration with Bootstrap, Foundation and the other styling libraries supported by DataTables