DEV Community

Cover image for How to add Filtering to Jquery Datatables
Samson Adesanoye
Samson Adesanoye

Posted on

How to add Filtering to Jquery Datatables

DataTables has a number of table control elements available and where they are placed in the DOM. The table control elements is defined by the dom parameter. This parameter can be a little confusing at first, because letters are used to represent different element for example the letter B is used for Buttons in the example below:

$('#myTable').DataTable( {
    dom: 'Bfrtip',
    buttons: [
        'copy', 'excel', 'pdf'
    ]
} );
Enter fullscreen mode Exit fullscreen mode

Meaning:
l - length changing input control
f - filtering input
t - The table!
i - Table information summary
p - pagination control
r - processing display element

Plugins:
B - Buttons
R - ColReorder
S - Scroller
P - SearchPanes
Q - SearchBuilder

Conclusion
Combining plugins together with different letters bring the best out of jquery datatables.

Top comments (0)