Comments (3)
Could you try something like this?
<script lang="ts">
import VirtualList from 'svelte-tiny-virtual-list';
import {createTable} from 'svelte-headless-table';
const table = createTable();
const columns = table.createColumns(...);
const {rows} = table.createViewModel(columns);
</script>
<table>
<thead>...</thead>
<!-- use the virtual list component as `tbody` -->
<!-- we can PR `asChild` or `as` support for `svelte-tiny-virtual-list` -->
<VirtualList
width="100%"
height={600}
itemCount={$rows.length}
itemSize={50}>
<svelte:fragment slot="item" let:index let:style>
{@const row = $rows[index]}
<Subscribe rowAttrs={row.attrs()}>
<tr {style} {...rowAttrs}>
{#each row.cells as cell (cell.id)}
<Subscribe attrs={cell.attrs()} let:attrs>
<td {...attrs}>
<Render of={cell.render()} />
</td>
</Subscribe>
{/each}
</tr>
</Subscribe>
</svelte:fragment>
</VirtualList>
</table>
from svelte-headless-table.
Not really, since the package adds two DOM elements to manage it's list, thus breaking the header columns (not aligned)
from svelte-headless-table.
@FluffyDiscord Full disclaimer, I've never used svelte-tiny-virtual-list
before but it's probably there to provide the overflow behaviour. Looking at it's code, it provides slots for the header and footer so you could try:
<script lang="ts">
import VirtualList from 'svelte-tiny-virtual-list';
import {createTable} from 'svelte-headless-table';
const table = createTable();
const columns = table.createColumns(...);
const {rows} = table.createViewModel(columns);
</script>
<!-- use the virtual list component as `table` -->
<!-- we can PR `asChild` or `as` support for `svelte-tiny-virtual-list` -->
<VirtualList
width="100%"
height={600}
itemCount={$rows.length}
itemSize={50}>
<thead slot="header">...</thead>
<svelte:fragment slot="item" let:index let:style>
{@const row = $rows[index]}
<Subscribe rowAttrs={row.attrs()}>
<tr {style} {...rowAttrs}>
{#each row.cells as cell (cell.id)}
<Subscribe attrs={cell.attrs()} let:attrs>
<td {...attrs}>
<Render of={cell.render()} />
</td>
</Subscribe>
{/each}
</tr>
</Subscribe>
</svelte:fragment>
</VirtualList>
from svelte-headless-table.
Related Issues (20)
- table undefined error. HOT 4
- Clickable row? HOT 5
- TypeScript issue when defining columns HOT 6
- Advanced pagination demo
- row.original gives type error HOT 4
- Make id optional HOT 3
- Consider adding a lessThan() to sorting plugin HOT 3
- Make render in column options optional when using the addColumnFilter plugin
- [Suggestion] Easier way to CRUD and to get selectedRow data HOT 3
- [Question] Reccomended way of doing virtualisation?
- reactive header? HOT 4
- setting allPageRowsSelected to "false" clears entire selection, not just the current page HOT 1
- Improvement to the filter
- Expose drag event HOT 2
- Cannot read properties of undefined (reading 'map') HOT 3
- Examples site 404 HOT 2
- Cell Event Dispatcher Isn't Reactive HOT 7
- v0.17.0 seems to break sorting HOT 2
- addColumnFilters: possible to filter by OR HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from svelte-headless-table.