Repeat header every "n" rows

Repeat header every "n" rows

Su4pSu4p Posts: 5Questions: 0Answers: 0
edited March 2014 in General
Hello,
I'm looking for a non-intrusive way to repeat the header every "n" rows.
My table is quite complexe with a lot of informations.
In order to make it more user friendly. I want to repeat the header row let's say every 3 rows.
example :
ID|date|status|
1|1980-01-01|0|
1|1980-01-01|0|
1|1980-01-01|0|
ID|date|status|
1|1980-01-01|0|
1|1980-01-01|0|
1|1980-01-01|0|
ID|date|status|
1|1980-01-01|0|
1|1980-01-01|0|
1|1980-01-01|0|
Of course I don't want the header rows to be searchable or sortable etc.... I want them to be just header.

Replies

  • Su4pSu4p Posts: 5Questions: 0Answers: 0
    The problem won't be one if there was multiple tbody/thead support.
    I'm desperately looking for a workaround.
  • lokomolokomo Posts: 8Questions: 0Answers: 0
    You know this: http://mkoryak.github.io/floatThead/
  • robertbrowerrobertbrower Posts: 158Questions: 1Answers: 0
    Try using the sScrollY option to set the scrollable area of the datatable to some height. A scroll bar will appear and the header will be stationary.
  • Su4pSu4p Posts: 5Questions: 0Answers: 0
    First thing first, thank you both of you for your interest.

    Both solutions do not answer to my problem.
    The first aim of what I'm trying to do is to seperate each row with a header.

    I have a view detailed(fnOpen) wich is always shown and contain an other table.

    So I have a person row with person's informations.
    just below I have a table with all events made by this particular person-it can be hudge in term of display informations-.
    What I want is below this table of events a header separator.

    On one hand it will work as a header reminder.
    On the other hand it will make a clear seperator in order to point out the user that he's looking the datas of an other person.

    I really need multiple headers :(
  • lokomolokomo Posts: 8Questions: 0Answers: 0
    i think you can achieve it by doing
    [code]
    //columnDefs
    "render" : function(data, type, full) {
    if(full.foo == 'seperator'){
    // build header
    }
    return header;
    }
    [/code]
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Currently you would need to use a method like this: http://datatables.net/release-datatables/examples/advanced_init/row_grouping.html . Rather than using the data to provide the logic for when to insert a row, you'd obviously just keep a count.

    Allan
  • Su4pSu4p Posts: 5Questions: 0Answers: 0
    lokomo : If you think your way is better than allan's please give me more informations about your snippet.
    allan : Thank you a lot I wasn't aware of this feature, this solution is working perfectly.

    Thank you both.
This discussion has been closed.