Add footer option to sDom

Add footer option to sDom

trudrungtrudrung Posts: 5Questions: 0Answers: 0
edited September 2012 in Feature requests
I'm using DataTables with ColumnFilterWidgets. I would like to add a ColumnFilterWidget to each column footer (TFOOT TR TH, TH, ...) in the table rather than having ColumnFilterWidgets group them in a separate DIV. It would look similar to this example: (one SELECT per column). One thought was to modify both DataTables and ColumnFilterWidgets:

DataTables modification:
Modify _fnAddOptionsHtml() to allow a new sDom option that would allow adding an object to the TFOOT object (oSettings.nTFoot). This would typically be a TR element that would be returned by ColumnFilterWidgets from ColumnFilterWidgets.fnInit().
else if ( cOption == '.' ) // '.' represents the option allowing TFOOT modifications
nInsertNode = the TFOOT object

ColumnFilterWidgets modifications:
Modify ColumnFilterWidgets() to format a TR element with TDs for all columns. ColumnFilterWidgets.fnInit() would return the TR element which DataTables would append to nInsertNode as it does now.

I'm not sure how feasible or sound my approach is.


  • allanallan Posts: 57,686Questions: 1Answers: 9,195 Site admin
    I'd probably say, rather than adding an option to DataTables, just modify the ColumnFilterWidgets plug-in. If it finds the footer empty (or even not present) then it can create it as required.

  • trudrungtrudrung Posts: 5Questions: 0Answers: 0
    I modified ColumnFilterWidgets to modify the footer as you suggested but it doesn't seem clean. It seems to violate the DataTables API (fnInit returns the object that gets added).
This discussion has been closed.