Fixed #241 - Move TreeTable filters to their own header row
parent
b76a9c502f
commit
5c0bf10e8a
|
@ -29,8 +29,14 @@
|
||||||
<TTColumnSlot :column="col" type="header" v-if="col.$scopedSlots.header" />
|
<TTColumnSlot :column="col" type="header" v-if="col.$scopedSlots.header" />
|
||||||
<span class="p-column-title" v-if="col.header">{{col.header}}</span>
|
<span class="p-column-title" v-if="col.header">{{col.header}}</span>
|
||||||
<span v-if="col.sortable" :class="getSortableColumnIcon(col)"></span>
|
<span v-if="col.sortable" :class="getSortableColumnIcon(col)"></span>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr v-if="hasColumnFilter()">
|
||||||
|
<template v-for="(col,i) of columns">
|
||||||
|
<th :key="col.columnKey||col.field||i" :class="getFilterColumnHeaderClass(col)" :style="col.filterHeaderStyle">
|
||||||
<TTColumnSlot :column="col" type="filter" v-if="col.$scopedSlots.filter" />
|
<TTColumnSlot :column="col" type="filter" v-if="col.$scopedSlots.filter" />
|
||||||
</th>
|
</th>
|
||||||
|
</template>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tfoot class="p-treetable-tfoot" v-if="hasFooter">
|
<tfoot class="p-treetable-tfoot" v-if="hasFooter">
|
||||||
|
@ -360,6 +366,9 @@ export default {
|
||||||
{'p-highlight': sorted}
|
{'p-highlight': sorted}
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
getFilterColumnHeaderClass(column) {
|
||||||
|
return ['p-filter-column', column.filterHeaderClass];
|
||||||
|
},
|
||||||
isColumnSorted(column) {
|
isColumnSorted(column) {
|
||||||
if (column.sortable)
|
if (column.sortable)
|
||||||
return this.sortMode === 'single' ? (this.d_sortField === (column.field || column.sortField)) : this.getMultiSortMetaIndex(column) > -1;
|
return this.sortMode === 'single' ? (this.d_sortField === (column.field || column.sortField)) : this.getMultiSortMetaIndex(column) > -1;
|
||||||
|
@ -733,6 +742,17 @@ export default {
|
||||||
else {
|
else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
hasColumnFilter() {
|
||||||
|
if (this.columns) {
|
||||||
|
for (let col of this.columns) {
|
||||||
|
if (col.$scopedSlots.filter) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
|
@ -593,6 +593,18 @@ export default {
|
||||||
<td>null</td>
|
<td>null</td>
|
||||||
<td>Style class of the column.</td>
|
<td>Style class of the column.</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>filterHeaderStyle</td>
|
||||||
|
<td>object</td>
|
||||||
|
<td>null</td>
|
||||||
|
<td>Inline style of the column filter header.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>filterHeaderClass</td>
|
||||||
|
<td>string</td>
|
||||||
|
<td>null</td>
|
||||||
|
<td>Style class of the column filter header.</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>filterMatchMode</td>
|
<td>filterMatchMode</td>
|
||||||
<td>string</td>
|
<td>string</td>
|
||||||
|
|
Loading…
Reference in New Issue