feat(VDataTable): always allow expand groupby#18536
feat(VDataTable): always allow expand groupby#18536Esgator wants to merge 2 commits intovuetifyjs:devfrom
Conversation
added groupExpanded prop to allow to always render group rows expanded
|
Thank you for the PR and your interest in improving Vuetify. Unfortunately this is not how we plan to introduce this functionality. |
Thanks for your response. Is it short term planned or can you share some informations how it should be done so i might help? |
|
@nekosaur Are there any information available on how this should be implemented? I would be interested in having this as well and would be open to contribute. |
|
Me too, but also, I would like to control which specific groups are expanded by default too, and to control them via a boolean. |
|
@nekosaur @johnleider Any chance to get some information on this so we could contribute the feature? (Or help in another way?) |
|
Right now we need a champion for the Data Table component. Albert is currently inactive. |
This comment was marked as outdated.
This comment was marked as outdated.
|
|
|
With this approach the toggle button will work and the groups will be expanded by default, once expanded the template will be removed allowing the expand/collapse button to work properly <script setup>
import { ref } from 'vue';
const expandedGroups = ref<Set<string>>(new Set())
</script>
<template>
<v-data-table ...>
<template v-if="props.groupBy"
#group-header="{ item, columns, toggleGroup, isGroupOpen }">
<tr>
<td :colspan="columns.length">
<template v-if="!expandedGroups.has(`${item.key}_${item.value}`)"> <!-- self removable template -->
<template :ref="(el) => { if (!isGroupOpen(item)) { expandedGroups.add(`${item.key}_${item.value}`); toggleGroup(item); } }"></template>
</template>
<v-btn ref="expandBtn"
:icon="isGroupOpen(item) ? '$expand' : '$next'"
size="small"
variant="text"
@click="toggleGroup(item)" />
</td>
</tr>
</v-data-table>
</template> |
This comment was marked as outdated.
This comment was marked as outdated.
6331ca7 to
564ccc8
Compare
a7fa817 to
2e2cddb
Compare
5b257fd to
86800d9
Compare
|
closing in favor of #22772 |
added groupExpanded prop to allow to always render group rows expanded
Description
I added a prop to all VDataTables to pass along with groupBy to make the groups always expand when set.
Markup: