xaksis / vue-good-table

An easy to use powerful data table for vuejs with advanced customizations including sorting, column filtering, pagination, grouping etc
https://xaksis.github.io/vue-good-table/
MIT License
2.16k stars 405 forks source link

Fixed header and horizontal scrolling misallinged column names #697

Open ProcopVladimirAlexandru opened 4 years ago

ProcopVladimirAlexandru commented 4 years ago

Issue Type (delete the irrelevant ones)

Specs

What version are you using? 2.19.1 (latest) What browser? Mozilla Firefox and Google Chrome

Expected Behavior

What did you expect to happen? When using fixed header and a wider table that requires horizontal scrolling I expected that the column names in the header will match the actual columns being horizontally scrolled through.

Actual Behavior

What actually happened? The header column names do not allign properly and have wrong width when scrolling horizontally. image

Steps to Reproduce the Problem

Please detail your steps here

  1. Use vue good table with fixed header
  2. Populate the table with a dataset with many wide columns
  3. There is a scroll bar for header and one for actual data instead of a single data scroll which simultaneously scrolls through the header.

Thank you for your help and this very good package!

TheJaredWilcurt commented 4 years ago

This will be very difficult to resolve as it is caused by the size of the scrollbar itself which varies depending on platform and browser. Specifically a scrollbar appears in one part of the table, but not another.

Two solutions I've seen before for this:

jstaerk commented 2 years ago

Really a great library, thanks. Except for this issue 😢 .

A "Javascript scrollbar" (e.g. https://www.w3schools.com/howto/howto_css_custom_scrollbar.asp) does not seem to help for me and if there were scrollbars on all sections there would still be one for the head row and another one for the content which would be out of sync as soon as the first one is operated, wouldn't it?

Attached a screenshot image of this https://codepen.io/jstaerk/pen/WNZYOJR at 866px width demonstrating the issue: the horizontal scroll bar operates independently from the table header, so after scrolling, the columns don't match their headers any more.

yogithesymbian commented 1 year ago

ah i found alternative solution , tried to re render when screen has on change. my issue came from sidebar collapse so i need to watch the change or added a button for re-render only for good table

      <!-- table -->
      <vue-good-table
        :key="yoRender" // here is the alternative...
>
cwilby commented 1 year ago

See https://github.com/xaksis/vue-good-table/issues/373#issuecomment-1464514347

You can use position: sticky with some extra styling.