T
TanStack3y ago
afraid-scarlet

Svelte cell formatting

Hello, Using Svelte version of TanTable, I am struggling to format a cell with a background color that depends on the cell's value, like you can do with spreadsheets. I understand the need to define a cell() renderer for the specific column, but I am unclear on how to get it to work. In particular how and where to use flexRender()? A pointer to an example would be most helpful! Thanks in advance.
3 Replies
like-gold
like-gold3y ago
I only started using table today but my understanding is that you can add the flexRender as a value to cell and pass the component constructor as the first argument and the values as second arguments in an object, I don't think it's typed properly though
quickest-silver
quickest-silver3y ago
Hi, i think this discussion can help i tried it, it should work but as i said in following discussion i still can't make it works properly. #Svelte table cell formatting issue
afraid-scarlet
afraid-scarletOP3y ago
Follow up - I found what I needed to know in this tutorial by Philipp Hartenfeller. The key for me was the “renderComponent” routine that can be used to set up renderers for cell column headers, where flexComponent doesn’t work. Check the code under the /invoices route! https://github.com/phartenfeller/sveltekit-1.0-sqlite-demo-app
GitHub
GitHub - phartenfeller/sveltekit-1.0-sqlite-demo-app
Contribute to phartenfeller/sveltekit-1.0-sqlite-demo-app development by creating an account on GitHub.

Did you find this page helpful?