DataTables with colspan in the header

DataTables with colspan in the header

VIPStephanVIPStephan Posts: 1Questions: 0Answers: 0
edited September 2012 in Feature requests
I know this has been addressed a few times before but I just had a case where I had two non-sortable columns with one merged header cell. I imagine that technically it wouldn’t be such a huge thing to implement colspan on header cells if the columns aren’t supposed to be sorted anyway? Forgive me if I may sound ignorant because I’m very new to DataTables and don’t know what’s actually involved. It just would be nice to have.

Replies

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin
    > I imagine that technically it wouldn’t be such a huge thing to implement colspan on header cells if the columns aren’t supposed to be sorted anyway?

    Actually, I'm afraid it would be. DataTables treats columns and rows each very individually. DataTables uses the column detection to know how many columns are in the table for example, so a colspan without unique cells for the columns would completely throw that out. Its also not just sorting which uses these, but filtering and anything else that works with column data.

    So I'm afraid, although in concept it sounds like a relatively easy modification, and it is in some places of the code, it would have a significant impact on how DataTables works overall.

    Having said that, I do want to find a good way of doing this in future. Data presentation tables could quite legitimately make a wide variety of uses of this technique, so this is something I very much want to support - but have yet to find a good way to do it. I'm wondering if the changes I'm planning to 1.10 to allow columns to be dynamically added and removed will help...

    Allan
This discussion has been closed.