我是Vutify的新手,正在努力将默认的筛选和排序功能添加回具有定制标题的表中.
超文本标记语言:
<v-data-table
:headers="headers"
:items="items"
item-key="client"
:footer-props="footerProps"
:search="search"
class="text-body-1"
>
<template #header="{ props }">
<thead class="v-data-table-header">
<tr>
<th
v-for="header in props.headers"
:key="header.value"
:class="{
'grey white--text text-body-1': true,
'sortable': header.sortable,
'filter': header.filterable,
}"
scope="col"
>
{{ header.text }}
</th>
</tr>
</thead>
</template>
我正在处理的标头的数据 struct 如下:
headers: [
new TableHeader('Number', 'index', false, false),
new TableHeader('EMP Code', 'empCode', false, false),
]
和表格标题:
export default function (header, prop, sortable = true, filterable = false, align = 'start') {
this.text = header
this.value = prop
this.sortable = sortable
this.filterable = filterable
this.align = align
}
有了所有这些,表格标题看起来就像它应该的样子,但我不能再点击标题并对其进行排序.
有谁知道如何添加默认筛选器并重新排序,或者可能只是一种不同的方式来设置标题的样式,从而保留默认标题功能和自定义样式.除了样式之外,页眉上没有任何变化.
(我见过很多类似这个问题的问题,但没有一个能以我可以复制的方式真正回答:)
我期望我的页眉具有带有默认功能(排序、筛选等)的自定义样式,但我得到的是没有默认功能(排序、筛选等)的自定义外观.