themesberg / themesberg/flowbite
[datatables] `fixedColumns` = true not working (columns resize when paginating)
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 9.4k
- Forks
- 862
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
simple-datatables has it's option fixedColumns set to true by default, but it does not work.
When navigating through the pages, the column width's change.
To Reproduce
Steps to reproduce the behavior:
- Go to https://flowbite.com/docs/plugins/datatables/#table-pagination
- Click on the next page in datatable
- The width's of the columns change
Expected behavior
Datatables should have fixed columns by default, so when navigating column width of columns won't change.
Additional context
How this works is that simple-datatables calculates the width for each column and puts that in the header like:
<th style="width: 25.261780104712038%;">
<span class="flex items-center">
Model Name
</span>
</th>
The issue is Flowbite adds:
.datatable-wrapper .datatable-table tbody td, .datatable-wrapper .datatable-table tbody th, .datatable-wrapper .datatable-table thead th {
width: auto !important;
}
See https://github.com/themesberg/flowbite/blob/main/plugin.js#L710
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the pagination behavior at the Flowbite datatables example, then inspect plugin.js around line 710 and the related datatable styles. Confirm that the fix preserves simple-datatables' calculated column widths, and verify that widths remain unchanged when moving between pages.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, javascript, tailwindcss
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100