File tree Expand file tree Collapse file tree 2 files changed +18
-19
lines changed
dev/components/components
src/vue-components/data-table Expand file tree Collapse file tree 2 files changed +18
-19
lines changed Original file line number Diff line number Diff line change 9292 </div >
9393
9494 <q-data-table
95- ref =" table"
9695 :data =" table"
9796 :config =" config"
9897 :columns =" columns"
@@ -140,17 +139,9 @@ export default {
140139 this .table .splice (row .index , 1 )
141140 })
142141 },
143- refresh (start ) {
144- if (! start) {
145- if (this .timeout ) {
146- clearTimeout (this .timeout )
147- this .timeout = null
148- }
149- return
150- }
142+ refresh (done ) {
151143 this .timeout = setTimeout (() => {
152- this .$refs .table .toggleRefresh ()
153- this .timeout = null
144+ done ()
154145 }, 5000 )
155146 }
156147 },
Original file line number Diff line number Diff line change 33 <div v-if =" hasToolbar && toolbar === ''" class =" q-data-table-toolbar upper-toolbar row reverse-wrap items-center justify-end" >
44 <div v-if =" config.title" class =" q-data-table-title ellipsis auto" v-html =" config.title" ></div >
55 <div class =" row items-center" >
6- <button v-if =" config.refresh" class =" primary clear" @click =" toggleRefresh" >
7- <i v-text =" refreshing ? 'cached' : 'refresh'" :class =" {'animate-spin-reverse': refreshing}" ></i >
6+ <button v-if =" config.refresh && !refreshing" class =" primary clear" @click =" refresh" >
7+ <i >refresh</i >
8+ </button >
9+ <button v-if =" refreshing" class =" disabled" >
10+ <i class =" animate-spin-reverse" >cached</i >
811 </button >
912 <button v-if =" config.filter" class =" primary clear" @click =" toolbar = 'filter'" >
1013 <i >filter_list</i >
@@ -221,12 +224,17 @@ export default {
221224 format (row , col ) {
222225 return col .format ? col .format (row[col .field ]) : row[col .field ]
223226 },
224- refresh (active ) {
225- this .refreshing = active
226- this .$emit (' refresh' , active)
227- },
228- toggleRefresh () {
229- this .refresh (! this .refreshing )
227+ refresh (done ) {
228+ if (done === true ) {
229+ this .refreshing = false
230+ return
231+ }
232+ if (! this .refreshing ) {
233+ this .refreshing = true
234+ this .$emit (' refresh' , () => {
235+ this .refreshing = false
236+ })
237+ }
230238 }
231239 },
232240 components: {
You can’t perform that action at this time.
0 commit comments