10
10
:density =" tableSettings.density"
11
11
:drilldown-key =" tableSettings.drilldownKey"
12
12
:elevation =" tableSettings.elevation"
13
+ :footers =" tableSettings.footers.users"
13
14
:headers =" tableSettings.headers.users"
14
15
:hover =" tableSettings.hover"
15
16
:items =" tableSettings.items"
17
+ :items-length =" tableSettings.itemsLength"
16
18
:items-per-page =" tableSettings.itemsPerPage"
17
19
:levels =" tableSettings.levels"
20
+ :show-footer-row =" tableSettings.showFooterRow"
18
21
:show-search =" tableSettings.showSearch"
19
22
@drilldown =" fetchData($event)"
20
23
>
47
50
:item-value =" tableSettings.itemValue"
48
51
:items =" defaultTableItems"
49
52
:items-per-page =" tableSettings.itemsPerPage"
50
- :loading =" tableSettings.loading"
51
- :loading-text =" tableSettings.loadingText"
52
53
:multi-sort =" tableSettings.multiSort"
53
54
:no-data-text =" tableSettings.noDataText"
54
55
:page =" tableSettings.page"
66
67
</td >
67
68
</tr >
68
69
</template >
69
-
70
- <template #[` footer.prepend ` ]>
71
- <div class =" me-2" >
72
- [footer.prepend Slot]
73
- </div >
74
- </template >
75
70
</v-data-table >
76
71
</v-col >
77
72
</v-row >
@@ -85,7 +80,6 @@ onMounted(() => {
85
80
fetchComments ();
86
81
});
87
82
88
-
89
83
const tableSettings = ref ({
90
84
colors: {
91
85
body: {
@@ -125,6 +119,85 @@ const tableSettings = ref({
125
119
fixedHeader: true , // ! Failed
126
120
// footerProps: {}, // ? In v2 Missing in v3
127
121
// groupBy: [], // * Works, but this does not look very good by default
122
+ footers: {
123
+ comments: [
124
+ {
125
+ title: ' ' ,
126
+ align: ' start' ,
127
+ key: null ,
128
+ width: 100 ,
129
+ },
130
+ {
131
+ title: ' Post ID' ,
132
+ align: ' start' ,
133
+ key: ' postId' ,
134
+ width: 100 ,
135
+ },
136
+ {
137
+ title: ' Comment ID' ,
138
+ align: ' start' ,
139
+ key: ' id' ,
140
+ width: 150 ,
141
+ },
142
+ {
143
+ title: ' Comment' ,
144
+ align: ' start' ,
145
+ key: ' name' ,
146
+ },
147
+ {
148
+ key: ' data-table-expand' ,
149
+ title: ' ' ,
150
+ },
151
+ ],
152
+ posts: [
153
+ {
154
+ title: ' User ID' ,
155
+ align: ' start' ,
156
+ key: ' userId' ,
157
+ width: 100 ,
158
+ },
159
+ {
160
+ title: ' Post ID' ,
161
+ align: ' start' ,
162
+ key: ' id' ,
163
+ width: 250 ,
164
+ },
165
+ {
166
+ title: ' Post' ,
167
+ align: ' start' ,
168
+ key: ' title' ,
169
+ },
170
+ {
171
+ key: ' data-table-expand' ,
172
+ title: ' ' ,
173
+ },
174
+ ],
175
+ users: [
176
+ {
177
+ title: ' User ID' ,
178
+ align: ' start' ,
179
+ key: ' id' ,
180
+ width: 350 ,
181
+ },
182
+ {
183
+ title: ' Name' ,
184
+ align: ' start' ,
185
+ key: ' name' ,
186
+ },
187
+ {
188
+ title: ' Email' ,
189
+ align: ' start' ,
190
+ key: ' email' ,
191
+ renderCell() {
192
+ return ' Total' ;
193
+ },
194
+ },
195
+ {
196
+ key: ' data-table-expand' ,
197
+ title: ' ' ,
198
+ },
199
+ ],
200
+ },
128
201
headers: {
129
202
comments: [
130
203
{
@@ -194,6 +267,9 @@ const tableSettings = ref({
194
267
title: ' Email' ,
195
268
align: ' start' ,
196
269
key: ' email' ,
270
+ // renderFooter() {
271
+ // return 'Total';
272
+ // },
197
273
},
198
274
{
199
275
key: ' data-table-expand' ,
@@ -211,10 +287,11 @@ const tableSettings = ref({
211
287
itemTitle: ' title' , // * Works, but is weird
212
288
itemValue: ' id' , // * Works, but is weird
213
289
items: [],
290
+ itemsLength: 0 ,
214
291
itemsPerPage: 10 , // * Works
215
292
levels: 2 , // * Works - Custom Prop
216
- loading: false , // ! Failed - https://github.com/vuetifyjs/vuetify/issues/16811
217
- loadingText: ' Loading...' , // ! Failed - https://github.com/vuetifyjs/vuetify/issues/16811
293
+ // loading: false, // ! Failed - https://github.com/vuetifyjs/vuetify/issues/16811
294
+ // loadingText: 'Loading...', // ! Failed - https://github.com/vuetifyjs/vuetify/issues/16811
218
295
// modelValue: [], // ? Needs Testing
219
296
multiSort: false , // * Works
220
297
mustSort: false , // * Works
@@ -237,6 +314,7 @@ const tableSettings = ref({
237
314
variant: ' underlined' ,
238
315
},
239
316
// server: false, // ? Needs Testing. This requires v-data-table-server
317
+ showFooterRow: true ,
240
318
showSearch: false ,
241
319
showExpand: false , // * Works
242
320
showSelect: false , // * Works
@@ -248,6 +326,7 @@ const tableSettings = ref({
248
326
249
327
function fetchData(drilldown = null ) {
250
328
const item = drilldown ?.item ?.raw ?? null ;
329
+ // tableSettings.value.loading = true;
251
330
252
331
let url = ' https://jsonplaceholder.typicode.com/users' ;
253
332
let user = null ;
@@ -269,9 +348,12 @@ function fetchData(drilldown = null) {
269
348
.then (response => response .json ())
270
349
.then (json => {
271
350
// console.log('fetch response', json);
351
+ tableSettings .value .itemsLength = json .length ;
352
+
272
353
273
354
if (! drilldown ) {
274
355
tableSettings .value .items = json ;
356
+ // tableSettings.value.loading = false;
275
357
return ;
276
358
}
277
359
@@ -284,6 +366,7 @@ function fetchData(drilldown = null) {
284
366
285
367
drilldownKey: ' id' ,
286
368
headers: [... tableSettings .value .headers .posts ],
369
+ footers: [... tableSettings .value .footers .posts ],
287
370
items: [... json ],
288
371
level: 1 ,
289
372
};
@@ -296,6 +379,7 @@ function fetchData(drilldown = null) {
296
379
post .children = {
297
380
drilldownKey: ' id' ,
298
381
headers: [... tableSettings .value .headers .comments ],
382
+ footers: [... tableSettings .value .footers .comments ],
299
383
items: [... json ],
300
384
level: 2 ,
301
385
};
0 commit comments