trentrichardson / jQuery-Timepicker-Addon

Adds a timepicker to jQueryUI Datepicker
http://trentrichardson.com/examples/timepicker/
MIT License
2.66k stars 1.05k forks source link

When using controlType: 'select' rendering takes over 500ms #771

Open SuneRadich opened 9 years ago

SuneRadich commented 9 years ago

I noticed that when you use controlType: 'select'. The picker is sluggish to open. Both when I used it on my page, but also on the examples page on http://trentrichardson.com/examples/timepicker/#basic_examples I narrowed it down to being the fact that the selections are rendered as selects and not sliders.

The reason is, that the picker has to render 1000 option tags for the milisecond and microsecond dropdowns - eventhough the picker is not configured to use those selections. The rendering can take up to 200ms to render for each of them!

A workaround is to set the stepMillisec and stepMicrosec to 1000 when configuring the datetimepicker, so that it only renders out one option for each.

The right solution would be to not render them at all when they are not needed .

joshstrange commented 9 years ago

THANK YOU SO MUCH!!!!

I've spent the last few hours trying to figure out why 1.2.2 was so snappy for us but 1.5.5 but super laggy. I know that Milli/Micro happened in between (1.3 I think but there is no changelog). Setting the value like you describe results in a night and day difference (You can REALLY feel it when changing months).

I've put together a JSFiddle for 1.5.3 here showing the difference: https://jsfiddle.net/44npg1fx/

It's crazy how much of a difference there is.