Skip to content

Commit

Permalink
fix: resolve TypeScript type error for expanded state
Browse files Browse the repository at this point in the history
  • Loading branch information
HarshilPatel007 committed Mar 3, 2025
1 parent 719eb77 commit fb9201c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions examples/vue/grouping/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
getGroupedRowModel,
useVueTable,
type ColumnDef,
type GroupingState,
type ExpandedState,
type GroupingState,
} from '@tanstack/vue-table'
import { ref } from 'vue'
Expand Down Expand Up @@ -133,9 +133,10 @@ const table = useVueTable({
// Toggle row expanded state
const toggleRowExpanded = (id: string): void => {
const currentExpanded = expanded.value as Record<string, boolean>
expanded.value = {
...expanded.value,
[id]: !expanded.value[id],
...currentExpanded,
[id]: !currentExpanded[id],
}
}
Expand Down Expand Up @@ -212,7 +213,7 @@ const clearGrouping = (): void => {
class="expand-button"
@click="toggleRowExpanded(row.id)"
>
<span v-if="expanded[row.id]" class="icon">👇</span>
<span v-if="row.getIsExpanded()" class="icon">👇</span>
<span v-else class="icon">👉</span>
<span class="group-value">{{ cell.getValue() }}</span>
<span class="group-count"> ({{ row.subRows.length }}) </span>
Expand Down

0 comments on commit fb9201c

Please sign in to comment.