grid-js / gridjs

Advanced table plugin
https://gridjs.io
MIT License
4.39k stars 240 forks source link

Incorrect nested header - colspan vaue not correct #1442

Open ecofi opened 4 months ago

ecofi commented 4 months ago

Describe the bug If the parent column includes only one child column and the child columns includes multiple columns, the header of the parent column is incorrect. I did not test if other scenarios are possible also resulting in incorrect colspan value and might be assesses in fixing the issue.

To Reproduce Steps to reproduce the behavior: This is an example, modified from example page here: https://gridjs.io/docs/examples/nested-header const grid = new Grid({ columns: [ { name: 'Test', columns:[ { name: 'Name', columns: [{ name: 'First' }, { name: 'Last' }] } ] } ], data: Array(50).fill().map(x => [ faker.name.firstName(), faker.name.lastName(), faker.internet.email(), ]) });

The parent column header "Test" does not cover the full table.

Expected behavior In the above example, the parent column header "Test" should span across the full table

Screenshots See attached screenshot Screenshot from 2024-05-13 09-08-07

Additional context I really like the nested header feature.

I updated the initial post with an better example