pupudu / window-table

Windowing Table for React based on React Window
https://window-table.netlify.com/
170 stars 13 forks source link

Extra div table header #23

Closed frankcalise closed 4 years ago

frankcalise commented 5 years ago

When rendering Html5Table receive the following warning in console:

Warning: validateDOMNesting(...): <div> cannot appear as a child of <tr>. in div (created by AutoSizer) in AutoSizer (created by Measurer) in Measurer (created by HeaderRowRenderer) in tr (created by HeaderRowRenderer) in thead (created by THead) in THead (created by HeaderRowRenderer) in HeaderRowRenderer (created by WindowTable) in table (created by WindowTable) in div (created by WindowTable) in div (created by WindowTable) in WindowTable in WindowTable (created by Html5Table)

<table class="table table-condensed table-hover table-striped" style="width: 566px; margin-bottom: 0px;">
   <thead class=" table-header">
      <tr class="table-header-row" style="display: flex; position: relative;">
<!-- this comes from where? -->
         <div style="overflow: visible; height: 0px; width: 0px;"></div>
         <th class="table-header-cell" column="[object Object]" style="width: 150px; display: inline-block; flex-grow: 150;">Name</th>
         <th class="table-header-cell" column="[object Object]" style="width: 50px; display: inline-block; flex-grow: 50;">Open</th>
         <th class="table-header-cell" column="[object Object]" style="width: 50px; display: inline-block; flex-grow: 50;">Late</th>
         <th class="table-header-cell" column="[object Object]" style="width: 50px; display: inline-block; flex-grow: 50;">15m/60m</th>
         <th class="table-header-cell" column="[object Object]" style="width: 50px; display: inline-block; flex-grow: 50;">Earliest</th>
         <div class="resize-triggers">
            <div class="expand-trigger">
               <div style="width: 567px; height: 33px;"></div>
            </div>
            <div class="contract-trigger"></div>
         </div>
      </tr>
   </thead>
</table>
pupudu commented 5 years ago

Hi @frankcalise Thank you for reporting this issue.

The reason we see the above error is due to how the table dimensions are measured. The table itself is rendered with the correct element hierarchy, just not the measures.

I am aware of this and is actually an issue with the react-virtualized-auto-sizer. I created https://github.com/bvaughn/react-virtualized-auto-sizer/issues/2 there hoping for a fix. I am also considering to embed a custom version of the auto-sizer in the library. I'll keep you updated.

Cheers

pupudu commented 4 years ago

This has been fixed in v0.9.0 Thanks again for reporting the issue.

bmcgary commented 4 years ago

Not sure if this still a known issue, but I got this same error today using v0.10.5-alpha.1. Downgrading back to 0.9.0 did fix it though.