From: Minkyu Kang Date: Mon, 28 Jan 2013 08:11:15 +0000 (+0900) Subject: datatimepicker: don't open the popup before popupafterclose event is fired X-Git-Tag: accepted/tizen_2.1/20130425.023924~7^2~121 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=887acc5151efb334c61075d68038341cd115572a;p=platform%2Fframework%2Fweb%2Fweb-ui-fw.git datatimepicker: don't open the popup before popupafterclose event is fired Because of event processing order, block the open the popup before poupafterclose event is fired. (N_SE-23027) Change-Id: I0d95463d534c3ccb59f197b1be0bf6bea2c8ce43 --- diff --git a/src/widgets/datetimepicker/js/jquery.mobile.tizen.datetimepicker.js b/src/widgets/datetimepicker/js/jquery.mobile.tizen.datetimepicker.js index e05d218..f1e08b2 100644 --- a/src/widgets/datetimepicker/js/jquery.mobile.tizen.datetimepicker.js +++ b/src/widgets/datetimepicker/js/jquery.mobile.tizen.datetimepicker.js @@ -388,7 +388,9 @@ var pat = target.jqmData( 'pat' ), hour, - text; + text, + self = this; + switch ( pat ) { case 'H': case 'HH': @@ -442,9 +444,10 @@ if ( target.text() != text ) { if ( target.hasClass("ui-datefield-selected") ) { target.addClass("out"); + this._new_value = text; target.animationComplete( function () { - target.text( text ); + target.text( self._new_value); target.addClass("in") .removeClass("out"); @@ -538,6 +541,7 @@ this.ui = $('
'); $(this.element).after( this.ui ); + this._popup_open = false; this.ui.bind('vclick', function ( e ) { obj._showDataSelector( obj, this, e.target ); }); @@ -666,7 +670,8 @@ $ctx, $li, i, - newLeft = 10; + newLeft = 10, + self = this; if ( !attr ) { return; @@ -674,6 +679,9 @@ if ( !field ) { return; } + if ( this._popup_open ) { + return; + } target.not('.ui-datefield-seperator').addClass('ui-datefield-selected'); @@ -707,16 +715,26 @@ $ctx.popupwindow( 'open', target.offset().left + ( target.width() / 2 ) + newLeft - window.pageXOffset , target.offset().top + target.height() - window.pageYOffset ); + + this._popup_open = true; + $div.bind('popupafterclose', function ( e ) { if ( obj._reflow ) { $(window).unbind("resize", obj._reflow); obj._reflow = null; } + + if ( !( target.hasClass("in") || target.hasClass("out") ) ) { + target.removeClass("ui-datefield-selected"); + } + $div.unbind( 'popupafterclose' ); $ul.unbind( 'vclick' ); $(obj).unbind( 'update' ); $ctx.popupwindow( 'destroy' ); $div.remove(); + + self._popup_open = false; }); $(obj).bind( 'update', function ( e, val ) {