Fixed #5006 - TableBody: Render "BodyRow" binding dataKey of props to key attribute
parent
fc1e3bdd47
commit
679977df48
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<tbody :ref="bodyRef" :class="cx('tbody')" role="rowgroup" :style="bodyStyle" v-bind="ptm('tbody', ptmTBodyOptions)">
|
<tbody :ref="bodyRef" :class="cx('tbody')" role="rowgroup" :style="bodyStyle" v-bind="ptm('tbody', ptmTBodyOptions)">
|
||||||
<template v-if="!empty">
|
<template v-if="!empty">
|
||||||
<template v-for="(rowData, rowIndex) of value" :key="rowIndex">
|
<template v-for="(rowData, rowIndex) of value" :key="getRowKey(rowData, rowIndex)">
|
||||||
<DTBodyRow
|
<DTBodyRow
|
||||||
:rowData="rowData"
|
:rowData="rowData"
|
||||||
:index="rowIndex"
|
:index="rowIndex"
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import BaseComponent from 'primevue/basecomponent';
|
import BaseComponent from 'primevue/basecomponent';
|
||||||
import { DomHandler, UniqueComponentId } from 'primevue/utils';
|
import { DomHandler, ObjectUtils, UniqueComponentId } from 'primevue/utils';
|
||||||
import BodyRow from './BodyRow.vue';
|
import BodyRow from './BodyRow.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -248,6 +248,9 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getRowKey(rowData, rowIndex) {
|
||||||
|
return this.dataKey ? ObjectUtils.resolveFieldData(rowData, this.dataKey) : rowIndex;
|
||||||
|
},
|
||||||
updateFrozenRowStickyPosition() {
|
updateFrozenRowStickyPosition() {
|
||||||
this.$el.style.top = DomHandler.getOuterHeight(this.$el.previousElementSibling) + 'px';
|
this.$el.style.top = DomHandler.getOuterHeight(this.$el.previousElementSibling) + 'px';
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue