Dynamic background color on single cell of DataTable
Posted: 03 Oct 2019, 14:02
I'm trying to use PrimeVue DataTable and stuck in the following: how to set background color for whole single table cell ? if i use a style inside slots, then the style is applied to nested div(for example) and background doesn't fully fill the cell (since there is padding in td style) and
is not what is required.
So how can one set specific class with 'background-color' on whole 'td' tag depending on the cell content ?
Any help will be appreciated
Code: Select all
<Column field="field" header="Field">
<template #body="slotProps">
<div :class="{ 'am-warn-cell': slotProps.data.field == '0'}">
{{slotProps.data.field}}
</div>
</template>
</Column>
So how can one set specific class with 'background-color' on whole 'td' tag depending on the cell content ?
Any help will be appreciated