File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
examples/vue/grouping/src Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 6
6
getGroupedRowModel ,
7
7
useVueTable ,
8
8
type ColumnDef ,
9
- type GroupingState ,
10
9
type ExpandedState ,
10
+ type GroupingState ,
11
11
} from ' @tanstack/vue-table'
12
12
import { ref } from ' vue'
13
13
@@ -133,9 +133,10 @@ const table = useVueTable({
133
133
134
134
// Toggle row expanded state
135
135
const toggleRowExpanded = (id : string ): void => {
136
+ const currentExpanded = expanded .value as Record <string , boolean >
136
137
expanded .value = {
137
- ... expanded . value ,
138
- [id ]: ! expanded . value [id ],
138
+ ... currentExpanded ,
139
+ [id ]: ! currentExpanded [id ],
139
140
}
140
141
}
141
142
@@ -212,7 +213,7 @@ const clearGrouping = (): void => {
212
213
class =" expand-button"
213
214
@click =" toggleRowExpanded(row.id)"
214
215
>
215
- <span v-if =" expanded[ row.id] " class =" icon" >👇</span >
216
+ <span v-if =" row.getIsExpanded() " class =" icon" >👇</span >
216
217
<span v-else class =" icon" >👉</span >
217
218
<span class =" group-value" >{{ cell.getValue() }}</span >
218
219
<span class =" group-count" > ({{ row.subRows.length }}) </span >
You can’t perform that action at this time.
0 commit comments