I would like to highlight a table row on '@click' in Vuejs. Currently I'm having an issue getting this to work.
Here is my html template where I'm binding class active to the Boolean 'isActive'.
<table
class="paginatedTable-table hide-table">
<thead class="paginatedTable-table-head">
<tr :class="{active: isActive}" class="paginatedTable-table-head-row">
<th
v-for="(column, key) in columns"
:key="key"
:class="column.align"
class="paginatedTable-table-head-row-header"
@click="sortTable(column)">
{{ column.label }}
<i
v-if="sortOptions.currentSortColumn === column.field"
:class="sortOptions.sortAscending ? icons.up : icons.down"
class="sort-icon" />
</th>
</tr>
I'm declaring the isActive in the data function and setting to false.
data() {
return {
width: '100%',
'marginLeft': '20px',
rowClicked: false,
filteredData: this.dataDetails,
isActive: false,
Function for button click where I'm setting isActive to true
async selectRow(detail) {
this.isActive = true;
this.width = '72%';
this.rowClicked = true;
This part I'm not so sure about. Here I'm setting the Css in Sass.
tr:not(.filters):not(.pagination-row) {
background-color: $white;
&.active{
background-color: $lc_lightPeriwinkle;
}