Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin: Resize columnWidth values break when data Promise is resolved #200

Open
hgoona opened this issue Mar 8, 2024 · 1 comment
Open

Comments

@hgoona
Copy link

hgoona commented Mar 8, 2024

I'm using the table as a svelte component and I'm receiving data as a promise, where a Loading Spinner displays until the data is resolved, where the data is then used in the table.

I've setup this minimum REPL that simulates this:
https://svelte.dev/repl/aebed9b9f2ad441e90a1163ab4f5cd6d?version=3.48.0

I'm finding my columnWidths are initially set correctly for the table, but when my data is resolved the columnWidths are arbitrarily changed/the configuration of the resize plugin appear to be lost.

What am I doing incorrectly?

@lolcabanon You mentioned your resize is working fine? Does the above situation look familiar?
@bryanmylee I noticed a few issues raised for the Resize Plugin and was wondering if this is related to the old issues? Do you know why the above is happening?

Versions:
"svelte-headless-table": "^0.18.2",
"@sveltejs/kit": "^2.5.2",

@lolcabanon
Copy link
Contributor

@hgoona Hey it's been a while.

I just looked at your REPL (very clean btw) and the only thing I did different was to use addGridLayout() plugin...

Have a look at this REP for a working example.

I basically added two things :

<script>
// ...

let table = createTable(dataStore, {
  resize: addResizedColumns(),
  grid: addGridLayout() // <-- HERE
});

// ...
</script>

<!-- ... -->

<style>
/* ... */

thead, tbody, tr {
  display: contents; /* <-- AND HERE */
}

/* ... */
</style>

There's some weird spacing appearing in the cells when a column become "too small" but should be easy to fix. Honestly, tables are a nightmare to work with... Except if absolutely necessary, I try to avoid them as much as possible!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants