Skip to content

Commit aa37b8d

Browse files
pdanpdanrstoenescu
authored andcommitted
fix QDatetimePicker: Reset to default view after closing modal (quasarframework#1762)
1 parent 48efcd4 commit aa37b8d

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

dev/components/form/input-test.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
<br><br>
6565
<q-datetime
6666
clearable
67+
type="datetime"
6768
class="q-ma-sm"
6869
@focus="donFocus"
6970
@blur="donBlur"
@@ -77,6 +78,7 @@
7778

7879
<q-datetime
7980
clearable
81+
type="datetime"
8082
class="q-ma-sm"
8183
@focus="donFocus"
8284
@blur="donBlur"
@@ -91,6 +93,7 @@
9193
<br><br>
9294
<q-datetime
9395
clearable
96+
type="datetime"
9497
class="q-ma-sm"
9598
@focus="donFocus"
9699
@blur="donBlur"
@@ -104,6 +107,7 @@
104107

105108
<q-datetime
106109
clearable
110+
type="datetime"
107111
class="q-ma-sm"
108112
@focus="donFocus"
109113
@blur="donBlur"

src/components/datetime/QDatetime.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,13 @@ export default {
162162
}
163163
})
164164
},
165+
__resetView () {
166+
// go back to initial entry point for that type of control
167+
// if it has defaultView it's going to be reapplied anyway on focus
168+
if (!this.defaultView) {
169+
this.$refs.target.setView()
170+
}
171+
},
165172

166173
__getPicker (h, modal) {
167174
return [
@@ -191,11 +198,7 @@ export default {
191198
canClose: () => {
192199
if (this.isPopover) {
193200
this.hide()
194-
// go back to initial entry point for that type of control
195-
// if it has defaultView it's goint to be reapplied anyway on focus
196-
if (!this.defaultView) {
197-
this.$refs.target.setView()
198-
}
201+
this.__resetView()
199202
}
200203
}
201204
}
@@ -216,6 +219,7 @@ export default {
216219
click: () => {
217220
this.__onHide()
218221
this.hide()
222+
this.__resetView()
219223
}
220224
}
221225
}),
@@ -231,6 +235,7 @@ export default {
231235
click: () => {
232236
this.__onHide(true)
233237
this.hide()
238+
this.__resetView()
234239
}
235240
}
236241
})

0 commit comments

Comments
 (0)