ankurk91 / vue-bootstrap-datetimepicker

Vue.js component for eonasdan bootstrap datetimepicker
MIT License
223 stars 66 forks source link

[support] Linked Pickers not working if component has :wrap="true" #2

Closed archer3cl closed 7 years ago

archer3cl commented 7 years ago

I'm submitting a ... (check one with "x")

[  ] Bug report => search github for a similar issue or PR before submitting
[ ] Feature request
[x ] Other, please describe, support

Tell about your platform

Current behavior Linked Pickers does not have the .data('DateTimePicker') value (shown as undefined) if the element has :wrap="true"

Expected behavior Linked Pickers should work as in the example provided in the docs

Minimal reproduction of the problem with instructions Clean installation of the component. In the next fiddle pick start date first and then end date. Look console for errors https://jsfiddle.net/Archer3CL/nev02jcf/

ankurk91 commented 7 years ago

@archer3cl You are trying to bind to wrong DOM element. When you set :wrap="true" the date picker is bind to its parent element so you need to add ref to input-group instead.

<div class="input-group" ref="startDate">

And then you can get the datepicker instance like this.

let $startDate = $(this.$refs.startDate);

You can see updated js fiddle. https://jsfiddle.net/nev02jcf/9/