svelte-table icon indicating copy to clipboard operation
svelte-table copied to clipboard

Scrollable tbody?

Open sonyseng opened this issue 5 years ago • 1 comments

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?

sonyseng avatar Sep 18 '20 21:09 sonyseng

👍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

dasDaniel avatar Sep 18 '20 21:09 dasDaniel