androidjquerycordovadatepickermobiscroll

Mobiscroll datepicker sometimes require more click to open [Phonegap]


I am developing a mobile app using phonegap and im using mobiscroll for the datepicker.

Here is what's happening, i have a text box, when clicked/touched the datepicker pops up. Now, the problem is sometimes when I click/touch it, it only gets the focus but nothing happens. I have to click the body then click again the text box for the datepicker to pop up.

I don't know what's wrong because it is working sometimes. It works perfectly on iOS devices but on android device it is not consistent.

Hope someone could help, thanks in advance.


Solution

  • Well, I fixed the problem.

    I override the datepicker's focus event to trigger the click event and commented the focus() command when pressing the cancel button to prevent it from popping up over and over again when cancel was pressed.

    ISAPP.ui.main.on('focus','.datepicker', function() { 
       $(this).trigger('click');
    });
    

    then on the plugin:

    if (Y) {
      a3.remove()
    } else {
      setTimeout(function () {
        a3.remove();
        if (O) {
           A = true;
           /*O.focus()*/    //I commented this. (focus on element after cancel)
        }
      }, Z ? 350 : 1)
    }
    

    Hope this helps someone in the future.