How to tell DataTables include footer in generated table?

How to tell DataTables include footer in generated table?

tiendqtiendq Posts: 9Questions: 0Answers: 0

Hi,

I created a DataTable instance in its simple form with following code, it works well except there is no footer. I have seen an option to include footer anywhere. How to?

Thanks,

var table = $("#test").DataTable();

Replies

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75
    edited October 2015

    Just use the tfoot..

    <table id="test">
        <thead>
        <tr>
            <th>A</th>
            <th>B</th>
            <th>C</th>
        </tr>
        </thead>
    
        <tfoot>
        <tr>
            <th>A</th>
            <th>B</th>
            <th>C</th>
        </tr>
        </tfoot>
    
        <tbody>
        <tr>
            <td>a</td>
            <td>b</td>
            <td>c</td>
        </tr>
        </tbody>
    </table>
    
  • tiendqtiendq Posts: 9Questions: 0Answers: 0

    But I use zero configuration with just an empty table tag, columns are configured in initiate code.

    For example: <table id="test"></table>

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75
  • allanallan Posts: 63,075Questions: 1Answers: 10,384 Site admin

    This is correct - there is no option to tell DataTables to create a footer for the table at the moment when there doesn't already exist a footer in the DOM.

    Allan

  • tiendqtiendq Posts: 9Questions: 0Answers: 0

    I have added a footer manually with inputs for column search but it'd be better if there is a built-in feature.

    Thanks for your answers.

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75

    This would be a great idea for a feature enhancemwnt tho :-)

    Maybe ill make a quick plugin for it

This discussion has been closed.