jonthornton / Datepair.js

A javascript plugin for intelligently selecting date and time ranges, inspired by Google Calendar.
https://www.jonthornton.com/Datepair.js
359 stars 85 forks source link

The timepicker closes and won't reappear.. #12

Closed afturner closed 10 years ago

afturner commented 10 years ago

I'm using jquery timepicker and this plugin just for the time, not the dates.

It works great, apart from one big bug. If I click on the time end box, the picker flashes and then closes. If I switch tabs and go back, the picker reappears and is fully functional.

What's the problem?

jonthornton commented 10 years ago

You'll need to post a demo or very specific/complete code so that I can reproduce this glitch. If I can't see it, I can't fix it.

afturner commented 10 years ago

Sure of course, I was sort of hoping it was a common problem.

I am generating the code via jquery dynamically and then calling a function to bind the elements to the timepicker and datepair.

function loadTimepickers() {
        $('.time,.start').timepicker({'step': 15, 'minTime': '5:00am', 'maxTime': '11:30pm'});
        $('.time,.end').timepicker({'step': 15, 'maxTime': '11:45pm', 'showDuration': true});
        $('#evnttimes').datepair();
}

The dynamic html is:

<p id="evnttimes"><input type="text" class="time start" /> to <input type="text" class="time end" /></p>

Edit: I am generating the code dynamically via a popModal. If you'd like, I can show you the page online, however it generates no errors so I don't know how useful that would be.

jonthornton commented 10 years ago

Thanks. Couple more questions:

I might not be able to dig into this further til tomorrow.

afturner commented 10 years ago

Thanks for your help. It only happens as when I generate it dynamically. I'm thinking it will be less of a hassle for me to do what I needed to do manually.

Thank you anyway, and sorry to waste your time.

jonthornton commented 10 years ago

No problem; glad you got it working. Don't hesitate to report an issue if you encounter any more weirdness.