Reputation: 194
Is there a way to add a class to filtered columns using yadcf?
As for now, When I filter a column on my table using a select box provided by yadcf, I can't seem to show that the column is filtered.
I want to add a class to the columns <th>
so that I can style it to show my users that the corresponding column is filtered.
Thanks in advance.
Upvotes: 0
Views: 677
Reputation: 194
Solved it using the .inuse
class from yadcf.
It's a class that yadcf applies on a filtered column.
All I had to do was add
$(".yadcf-filter.inuse").closest("th").addClass("bg-filter");
to my DataTables' drawCallback
.
Upvotes: 0
Reputation: 37061
yadcf allows you to add custom class
on the filter itself by using the style_class property and anyway IMO making entire column look differently when filtered is too much
Upvotes: 1