In Laravel 12 / vuejs 33.5.13 / element-plus 2.9.5 app I have a table with dynamic columns in labels
array like :
<el-table :data="items" style="width: 100%"
:row-class-name="tableRowClassName"
:header-row-class-name="headerRowClassName"
>
<el-table-column label="ID" prop="id"></el-table-column>
...
<!-- create dynamic list of columns -->
<el-table-column v-for="(label, index) in labels" v-if="labels"
:key="label.title_field"
:prop="label.value_field"
label="Label Text"
:min-width="80">
</el-table-column>
</el-table>
I found branch Background colors to rows of a element-ui table with pagination in vueJS 2 but failing to render
and I to make in similar way but I do not know how can I refer to column name dynamically, as any row has columns like :
labels_length
item_1_value
item_2_value
item_3_value
and method :
methods: {
tableRowClassName({row, rowIndex}) {
for (let i=0;i< row.labels_length;i++) { //
if(100 < parseInt(row.getFieldValueByName['item_'+i+'_value'])) {
return 'warning-row-class';
}
}
The row
var has no any method like getFieldValueByName
and I wonder in which way I can get fields name dynamically ?