How to dynamically change the backgound color of cell in DataTable? #1482
testforvln99
started this conversation in
General
Replies: 2 comments
-
did you find a way to do this? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hello, it's possible to leverage Demo: https://svelte.dev/repl/d5ad7e17e80c4637856e5026a656c0a6?version=3.55.1 <DataTable
headers={headers}
rows={rows}
>
<svelte:fragment slot="cell" let:cell>
{#if cell.value === 'HTTP'}
<span class="highlight">{cell.value}</span>
{:else}
{cell.value}
{/if}
</svelte:fragment>
</DataTable>
<style>
.highlight {
background-color: yellow;
}
/* it's necessary to write the selector twice for Firefox */
:global(.bx--data-table td):has(.highlight) {
background-color: yellow;
}
</style> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to change the backgound color of cell in DataTable according to the changing value of the cell. I tried Theme component and Slot Cell but failed. How could I make it?
Beta Was this translation helpful? Give feedback.
All reactions