I define an action button in each table row and I wish to change the button class to awesome font icon base on another column value.
Kindly refer to the sample code below, I want to change the actionbtn
's icon base on btnval
after table is loaded. For example, when btnval=""
, actionbtn
class will be fas fa-check
else fas fa-undo
.
Can anyone advise how can I do it right? Thank you.
<table class="table ew-table" >
<thead>
<tr class="ew-table-header">
<th>Action</th>
<th>Result</th>
<th>BtnValue</th>
</tr>
</thead>
<tbody>
@for (int i = Table1_List.StartRowCount; i <= Table1_List.RowCount; i++)
{
<tr>
<td style="width: 30px !important; max-width:30px;">
<button id="actionbtn" type="button">
<i class="fas fa-check"></i>
</button>
</td>
<td>
<a>Table1_List[i].resultval</a>
</td>
<td>
<a>Table1_List[i].btnval</a>
</td>
</tr>
}
</tbody>
</table>