Problem with DT1.10+ using ColVis and HTML colgroup

Problem with DT1.10+ using ColVis and HTML colgroup

tom_supergantom_supergan Posts: 8Questions: 1Answers: 0
edited August 2017 in Free community support

When hiding columns of a table that has HTML <colgroup> defined (between <table> and <thead>), the table is shrunk by the width of the hidden columns instead of being resized to fit table width. This used to work fine up through DT1.9-, honoring the proportion of each column's <col> width.

Tried <table width="100%" style="width: 100%"> but no help preserving proportional column widths based on col settings after one or more columns are hidden.
http://live.datatables.net/vuwozone/1/

Replies

  • kthorngrenkthorngren Posts: 21,309Questions: 26Answers: 4,948

    I tried your test case and the table stays the full width after hiding one or more columns. Maybe I'm missing something in testing your issue.

    Kevin

  • tom_supergantom_supergan Posts: 8Questions: 1Answers: 0

    After hiding the Position and Office columns, the remaining columns have shifted left. The image shows the Search box and page numbers up against the right edge of where the right side of the columns used to be aligned.

  • kthorngrenkthorngren Posts: 21,309Questions: 26Answers: 4,948

    When I first tried your test case I was using Chrome. The table stays the width of the browser in Chrome. Tried Firefox and it behaves like your screenshot. Also tried Safari and it behaves the same as Chrome. These are all on the Mac.

    Not sure why firefox behavior is different.

    Kevin

  • tom_supergantom_supergan Posts: 8Questions: 1Answers: 0
    edited August 2017

    Yes, this fails in Firefox 53.0 (64-bit) on Microsoft Windows7. Thank you for verifying. This same browser works using DT1.9-.

    In DT1.10+ it appears that DT removes the corresponding column's <th>, but not its <col>. In DT1.9-, it appears that the table's <colgroup> is removed, but each column's width proportion is preserved (e.g., <col style="width: 17%"> + 1/6 of hidden columns' widths).

    Should this problem be reported as a bug somewhere else, or is this forum sufficient?

  • kthorngrenkthorngren Posts: 21,309Questions: 26Answers: 4,948

    Just need to make sure @allan notices this thread. If he doesn't respond by this time tomorrow maybe send him a PM.

    Kevin

  • allanallan Posts: 63,471Questions: 1Answers: 10,467 Site admin

    Thanks for flagging this up.

    I'm afraid that DataTables currently doesn't make any attempt to support colgroup. If it worked in 1.9- then it was a fluke.

    This is an area that I know is lacking in DataTables and hope to improve in future. Sorry I don't have a better answer at the moment! For now the workaround is not to use colgroup.

    Allan

This discussion has been closed.