Problem With DT1.10+ Using ColVis And HTML Colgroup - DataTables

DataTables Advanced interactionfeatures for your tables. Editor Comprehensive editinglibrary for DataTables. Manual Download
  • Examples
  • Manual
  • Reference
  • Extensions
  • Plug-ins
  • Blog
  • Forums
    • Discussions
    • Sign In
  • Support
  • FAQs
  • Download
  • Purchase
Show site navigation 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 August 2017 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,336Questions: 26Answers: 4,951 August 2017

    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 August 2017

    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.

    ColVis-not-resize.PNG 26.3K
  • kthorngrenkthorngren Posts: 21,336Questions: 26Answers: 4,951 August 2017

    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 August 2017 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,336Questions: 26Answers: 4,951 August 2017

    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,498Questions: 1Answers: 10,471 Site admin August 2017

    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. Sign In · Register

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Register

Quick Links

  • Categories
  • Recent Discussions
  • Unanswered

Categories

  • 74.3K All Categories
  • 56 Priority support
  • 24K Free community support
  • 997 General
  • 14 Announcements
  • 2.5K DataTables
  • 79 DataTables 2
  • 1.3K DataTables 1.10
  • 92 DataTables 1.9
  • 35 DataTables 1.8
  • 9 CloudTables
  • 2.2K Editor
  • 2.8K Extensions
  • 20 AutoFill
  • 310 Buttons
  • 50 ColVis
  • 30 DateTime
  • 68 FixedColumns
  • 50 FixedHeader
  • 31 ColReorder
  • 30 KeyTable
  • 103 Responsive
  • 23 RowReorder
  • 42 Scroller
  • 163 SearchBuilder
  • 193 SearchPanes
  • 107 Select
  • 26 StateRestore
  • 22 TableTools
  • 220 Bug reports
  • 67 Feature requests
  • 100 Plug-ins
  • 11 Blog
  • 69 Web-site

DataTables

DataTables designed and created by SpryMedia Ltd. © 2007-2023 MIT licensed. Privacy policy. Supporters. SpryMedia Ltd is registered in Scotland, company no. SC456502.

Từ khóa » Html Table Hide Column Colgroup