Skip to content

Commit c367384

Browse files
committed
feat(QTable): New props for bottom layer: hide-selected-banner, hide-no-data, hide-pagination quasarframework#2075
1 parent b3ce04b commit c367384

File tree

7 files changed

+202
-280
lines changed

7 files changed

+202
-280
lines changed

ui/dev/src/pages/components/data-table-part5.vue

Lines changed: 130 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
<template>
22
<div class="q-pa-md">
3+
<div class="row items-center q-gutter-sm q-mb-md">
4+
<q-btn label="Toggle data / no data" no-caps color="primary" @click="toggleData" />
5+
<q-toggle label="Hide bottom" v-model="hideBottom" />
6+
<q-toggle label="Hide sel rows banner" v-model="hideSelectedBanner" />
7+
<q-toggle label="Hide no data" v-model="hideNoData" />
8+
<q-toggle label="Hide pagination" v-model="hidePagination" />
9+
</div>
10+
311
<q-table
412
title="Treats"
5-
:data="data"
13+
:data="rows"
614
:columns="columns"
715
row-key="name"
816
selection="multiple"
917
:selected.sync="selected"
18+
:hide-bottom="hideBottom"
19+
:hide-selected-banner="hideSelectedBanner"
20+
:hide-no-data="hideNoData"
21+
:hide-pagination="hidePagination"
1022
no-hover
1123
>
1224
<template v-slot:body="props">
@@ -34,7 +46,7 @@
3446
<q-tr v-show="props.expand" :props="props" no-hover>
3547
<q-td colspan="100%">
3648
<q-table
37-
:data="data"
49+
:data="rows"
3850
:columns="columns"
3951
>
4052
<q-tr :props="props" />
@@ -47,9 +59,116 @@
4759
</template>
4860

4961
<script>
62+
const rows = [
63+
{
64+
name: 'Frozen Yogurt',
65+
calories: 159,
66+
fat: 6.0,
67+
carbs: 24,
68+
protein: 4.0,
69+
sodium: 87,
70+
calcium: '14%',
71+
iron: '1%'
72+
},
73+
{
74+
name: 'Ice cream sandwich',
75+
calories: 237,
76+
fat: 9.0,
77+
carbs: 37,
78+
protein: 4.3,
79+
sodium: 129,
80+
calcium: '8%',
81+
iron: '1%'
82+
},
83+
{
84+
name: 'Eclair',
85+
calories: 262,
86+
fat: 16.0,
87+
carbs: 23,
88+
protein: 6.0,
89+
sodium: 337,
90+
calcium: '6%',
91+
iron: '7%'
92+
},
93+
{
94+
name: 'Cupcake',
95+
calories: 305,
96+
fat: 3.7,
97+
carbs: 67,
98+
protein: 4.3,
99+
sodium: 413,
100+
calcium: '3%',
101+
iron: '8%'
102+
},
103+
{
104+
name: 'Gingerbread',
105+
calories: 356,
106+
fat: 16.0,
107+
carbs: 49,
108+
protein: 3.9,
109+
sodium: 327,
110+
calcium: '7%',
111+
iron: '16%'
112+
},
113+
{
114+
name: 'Jelly bean',
115+
calories: 375,
116+
fat: 0.0,
117+
carbs: 94,
118+
protein: 0.0,
119+
sodium: 50,
120+
calcium: '0%',
121+
iron: '0%'
122+
},
123+
{
124+
name: 'Lollipop',
125+
calories: 392,
126+
fat: 0.2,
127+
carbs: 98,
128+
protein: 0,
129+
sodium: 38,
130+
calcium: '0%',
131+
iron: '2%'
132+
},
133+
{
134+
name: 'Honeycomb',
135+
calories: 408,
136+
fat: 3.2,
137+
carbs: 87,
138+
protein: 6.5,
139+
sodium: 562,
140+
calcium: '0%',
141+
iron: '45%'
142+
},
143+
{
144+
name: 'Donut',
145+
calories: 452,
146+
fat: 25.0,
147+
carbs: 51,
148+
protein: 4.9,
149+
sodium: 326,
150+
calcium: '2%',
151+
iron: '22%'
152+
},
153+
{
154+
name: 'KitKat',
155+
calories: 518,
156+
fat: 26.0,
157+
carbs: 65,
158+
protein: 7,
159+
sodium: 54,
160+
calcium: '12%',
161+
iron: '6%'
162+
}
163+
]
164+
50165
export default {
51166
data () {
52167
return {
168+
hideBottom: false,
169+
hideSelectedBanner: false,
170+
hideNoData: false,
171+
hidePagination: false,
53172
selected: [],
54173
columns: [
55174
{
@@ -69,108 +188,15 @@ export default {
69188
{ name: 'calcium', label: 'Calcium (%)', field: 'calcium', sortable: true, sort: (a, b) => parseInt(a, 10) - parseInt(b, 10) },
70189
{ name: 'iron', label: 'Iron (%)', field: 'iron', sortable: true, sort: (a, b) => parseInt(a, 10) - parseInt(b, 10) }
71190
],
72-
data: [
73-
{
74-
name: 'Frozen Yogurt',
75-
calories: 159,
76-
fat: 6.0,
77-
carbs: 24,
78-
protein: 4.0,
79-
sodium: 87,
80-
calcium: '14%',
81-
iron: '1%'
82-
},
83-
{
84-
name: 'Ice cream sandwich',
85-
calories: 237,
86-
fat: 9.0,
87-
carbs: 37,
88-
protein: 4.3,
89-
sodium: 129,
90-
calcium: '8%',
91-
iron: '1%'
92-
},
93-
{
94-
name: 'Eclair',
95-
calories: 262,
96-
fat: 16.0,
97-
carbs: 23,
98-
protein: 6.0,
99-
sodium: 337,
100-
calcium: '6%',
101-
iron: '7%'
102-
},
103-
{
104-
name: 'Cupcake',
105-
calories: 305,
106-
fat: 3.7,
107-
carbs: 67,
108-
protein: 4.3,
109-
sodium: 413,
110-
calcium: '3%',
111-
iron: '8%'
112-
},
113-
{
114-
name: 'Gingerbread',
115-
calories: 356,
116-
fat: 16.0,
117-
carbs: 49,
118-
protein: 3.9,
119-
sodium: 327,
120-
calcium: '7%',
121-
iron: '16%'
122-
},
123-
{
124-
name: 'Jelly bean',
125-
calories: 375,
126-
fat: 0.0,
127-
carbs: 94,
128-
protein: 0.0,
129-
sodium: 50,
130-
calcium: '0%',
131-
iron: '0%'
132-
},
133-
{
134-
name: 'Lollipop',
135-
calories: 392,
136-
fat: 0.2,
137-
carbs: 98,
138-
protein: 0,
139-
sodium: 38,
140-
calcium: '0%',
141-
iron: '2%'
142-
},
143-
{
144-
name: 'Honeycomb',
145-
calories: 408,
146-
fat: 3.2,
147-
carbs: 87,
148-
protein: 6.5,
149-
sodium: 562,
150-
calcium: '0%',
151-
iron: '45%'
152-
},
153-
{
154-
name: 'Donut',
155-
calories: 452,
156-
fat: 25.0,
157-
carbs: 51,
158-
protein: 4.9,
159-
sodium: 326,
160-
calcium: '2%',
161-
iron: '22%'
162-
},
163-
{
164-
name: 'KitKat',
165-
calories: 518,
166-
fat: 26.0,
167-
carbs: 65,
168-
protein: 7,
169-
sodium: 54,
170-
calcium: '12%',
171-
iron: '6%'
172-
}
173-
]
191+
rows
192+
}
193+
},
194+
195+
methods: {
196+
toggleData () {
197+
this.rows = this.rows.length === 0
198+
? rows
199+
: []
174200
}
175201
}
176202
}

0 commit comments

Comments
 (0)