svelte-table
svelte-table copied to clipboard
Scrollable tbody?
I'd like to set the table to expand to 100% of the parent container with the thead fixed and the tbody scrollable. Is there a configuration for this?
👍gets a bit tricky...
One solution is to use css example: https://svelte.dev/repl/91c871dc626d40e0a5fac4296c9cdfe2?version=3.25.1
<style>
:global(tbody) {
height:250px;
overflow:auto;
display: block;
}
:global(thead, tbody tr) {
display:table;
width:100%;
table-layout:fixed;
}
</style>
the downside is that because it uses display block and 100% for the width, the column widths are all the same.
you can get around it with targeting individual columns using...
:global(th:nth-child(4), td:nth-child(4)) {
width: 60%;
}
but it's not ideal