Adding filters when is not possible to have html
Adding filters when is not possible to have html
I have a table with dynamic no. of columns. Works like charm but I need to add filters.
According to the documentation of multi filter select comment section,
bsided@v1.10.1212:07, Mon 21st Nov 2016
Make sure you have <tfoot></tfoot> block defined in your table otherwise there would be no footer!
(P.S. thanks @bsided for the tip. Saved me from losing my mind a few months ago when I started with filters)
I can't get filters to work without proper html <tfoot> values. Dynamic ones as in:
{
title: "My Title",
footer: "My Title",
data: "title"
}
does not work.
Any life saving idea?
This question has accepted answers - jump to:
Answers
I assume that since you are using dynamic columns, you are pre fetching your data with a regular ajax call or some other means.
Based on that you can create columns object, then update the table header and footer directly, then create the datatable.
There is no option for DataTables to dynamically create a footer element as it constructs the table at the moment. That is something that will probably be added in future, but at the moment you have you use regular DOM or jQuery methods to inject the footer before you initialise the DataTable.
Allan
Got it. Thanks.