^ Click Here

Thursday, August 9, 2012

[fixed] jQuery UI datepicker showing calendar when setting date.

For showing, choosing date jQuery UI datepicker is a great plugin, it provides a lot of functionality. However I feel it's little short on events, yet enough to fulfill almost all need of a basic application.

I was using that however I found an issue......with a few logic I was updating a date field which have a date picker when another field with datepicker was updated.

Problem : the primary datepicker was is visible and secondary is well say gets visible only when user wants. Since I was updating the secondary even when it was hidden.....it popped a calendar at the bottom of the page which of course was an annoying issue since it didn't use to disappear until and unless user clicks on some other datepicker enabled field.

I figured it out that the problem was with datepicker setDate function...I was using

$('.date-pick').datepicker('setDate', newDate)  //where date is a js date object.

I found that there is a hide function in datepicker, I tried that but it couldn't solve the problem

$('.date-pick').datepicker('setDate', newDate).datepicker('hide')   //failed miserably.

Hence I started to google it out......but didn't really got a satisfactory solution, but found out that few other people were facing the same problem. I got a hint from some site then I started looking into the datepicker js (I certainly am not a js expert).

there in the _setDateDatepicker function after setting the date value in the target it was calling _updateDatepicker which I assumed was popping the datepicker calendar but since the target was hidden it couldn't get the exact position hence it showed the calendar on the bottom left of the page.

So I commented that _updateDatepicker function out and it stopped popping the calendar while setting the date.



1 comment:

  1. SBOBET - Sportsbook in NV - MJH Hub
    SBOBET 구리 출장마사지 ialah situs 인천광역 출장샵 judi online terpercaya yang memiliki game judi online yang menyediakan berbagai game slot online, judi bola, 계룡 출장마사지 slot88 & 충청남도 출장안마 pragmatic play. 경산 출장샵

    ReplyDelete