DEV Community

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

Posted on

2

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.

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay