How I hide a row in the header of a datatable

How I hide a row in the header of a datatable

HxrxshoHxrxsho Posts: 3Questions: 1Answers: 0

Hi, I want to hide the first row, in this example I want to hide "Example 1"
https://live.datatables.net/clone/7930/edit

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,289Questions: 26Answers: 4,943
    edited April 9

    You can add style="display: none;" to the tr or use jQuery hide() in initComplete, like this:
    https://live.datatables.net/matofeku/1/edit

    In fact you could use jQuery hide() before initializing Datatables. Datatables doesn't have anything built in for hiding rows in the thead.

    Kevin

  • HxrxshoHxrxsho Posts: 3Questions: 1Answers: 0

    @kthorngren Thanks for your help, sorry I forgot to say that what I want to hide is in the excel button, not in the table

  • kthorngrenkthorngren Posts: 21,289Questions: 26Answers: 4,943
    Answer ✓

    See this thread.

    Kevin

  • HxrxshoHxrxsho Posts: 3Questions: 1Answers: 0

    It worked! I use customizeData in the exportOptions as seen here below

    buttons: [{
                 extend: 'excel',
                 exportOptions: {
                              customizeData : function(data) {
                                      data.headerStructure.shift();
                                }
                  }
    }]
    

    Thanks a lot

Sign In or Register to comment.