Fixed #3738 - DataTable: rowStyle function doesn't work

pull/3743/head
Tuğçe Küçükoğlu 2023-03-13 10:56:32 +03:00
parent 9a92f3eeb2
commit 50d7ac5782
2 changed files with 7 additions and 2 deletions

View File

@ -779,7 +779,7 @@ export interface DataTableProps {
/**
* A function that takes the row data as a parameter and returns the inline style for the corresponding row.
*/
rowStyle?: any;
rowStyle?: (data: any) => object | undefined;
/**
* When specified, enables horizontal and/or vertical scrolling.
* @defaultValue false

View File

@ -14,7 +14,7 @@
v-if="expandableRowGroups ? isRowGroupExpanded(rowData) : true"
:key="getRowKey(rowData, getRowIndex(index))"
:class="getRowClass(rowData)"
:style="rowStyle"
:style="getRowStyle(rowData)"
:tabindex="setRowTabindex(index)"
role="row"
:aria-selected="selectionMode ? isSelected(rowData) : null"
@ -282,6 +282,11 @@ export default {
return getItemOptions ? getItemOptions(index).index : index;
},
getRowStyle(rowData) {
if (this.rowStyle) {
return this.rowStyle(rowData);
}
},
getRowClass(rowData) {
let rowStyleClass = [];