Fixed #1932 - DataTable Dynamic Row defect
parent
812b260482
commit
b70ff261de
|
@ -6,7 +6,7 @@
|
||||||
</template>
|
</template>
|
||||||
</tr>
|
</tr>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<tr v-for="(row,i) of columnGroup.children.default()" :key="i" role="row">
|
<tr v-for="(row,i) of getFooterRows()" :key="i" role="row">
|
||||||
<template v-for="(col,j) of getFooterColumns(row)" :key="columnProp(col,'columnKey')||columnProp(col,'field')||j">
|
<template v-for="(col,j) of getFooterColumns(row)" :key="columnProp(col,'columnKey')||columnProp(col,'field')||j">
|
||||||
<DTFooterCell :column="col" v-if="!columnProp(col,'hidden')"/>
|
<DTFooterCell :column="col" v-if="!columnProp(col,'hidden')"/>
|
||||||
</template>
|
</template>
|
||||||
|
@ -35,6 +35,23 @@ export default {
|
||||||
columnProp(col, prop) {
|
columnProp(col, prop) {
|
||||||
return ObjectUtils.getVNodeProp(col, prop);
|
return ObjectUtils.getVNodeProp(col, prop);
|
||||||
},
|
},
|
||||||
|
getFooterRows() {
|
||||||
|
let rows = [];
|
||||||
|
|
||||||
|
let columnGroup = this.columnGroup;
|
||||||
|
if (columnGroup.children && columnGroup.children.default) {
|
||||||
|
for (let child of columnGroup.children.default()) {
|
||||||
|
if (child.type.name === 'Row') {
|
||||||
|
rows.push(child);
|
||||||
|
}
|
||||||
|
else if (child.children && child.children instanceof Array) {
|
||||||
|
rows = child.children;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
},
|
||||||
getFooterColumns(row){
|
getFooterColumns(row){
|
||||||
let cols = [];
|
let cols = [];
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<tr v-for="(row,i) of columnGroup.children.default()" :key="i" role="row">
|
<tr v-for="(row,i) of getHeaderRows()" :key="i" role="row">
|
||||||
<template v-for="(col,j) of getHeaderColumns(row)" :key="columnProp(col, 'columnKey')||columnProp(col, 'field')||j">
|
<template v-for="(col,j) of getHeaderColumns(row)" :key="columnProp(col, 'columnKey')||columnProp(col, 'field')||j">
|
||||||
<DTHeaderCell v-if="!columnProp(col, 'hidden') && (rowGroupMode !== 'subheader' || (groupRowsBy !== columnProp(col, 'field'))) && (typeof col.children !== 'string')" :column="col"
|
<DTHeaderCell v-if="!columnProp(col, 'hidden') && (rowGroupMode !== 'subheader' || (groupRowsBy !== columnProp(col, 'field'))) && (typeof col.children !== 'string')" :column="col"
|
||||||
@column-click="$emit('column-click', $event)" @column-mousedown="$emit('column-mousedown', $event)"
|
@column-click="$emit('column-click', $event)" @column-mousedown="$emit('column-mousedown', $event)"
|
||||||
|
@ -132,6 +132,23 @@ export default {
|
||||||
getFilterColumnHeaderStyle(column) {
|
getFilterColumnHeaderStyle(column) {
|
||||||
return [this.columnProp(column, 'filterHeaderStyle'), this.columnProp(column, 'style')];
|
return [this.columnProp(column, 'filterHeaderStyle'), this.columnProp(column, 'style')];
|
||||||
},
|
},
|
||||||
|
getHeaderRows() {
|
||||||
|
let rows = [];
|
||||||
|
|
||||||
|
let columnGroup = this.columnGroup;
|
||||||
|
if (columnGroup.children && columnGroup.children.default) {
|
||||||
|
for (let child of columnGroup.children.default()) {
|
||||||
|
if (child.type.name === 'Row') {
|
||||||
|
rows.push(child);
|
||||||
|
}
|
||||||
|
else if (child.children && child.children instanceof Array) {
|
||||||
|
rows = child.children;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
},
|
||||||
getHeaderColumns(row){
|
getHeaderColumns(row){
|
||||||
let cols = [];
|
let cols = [];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue