Search code examples
iframecordovasencha-touch-2

keyboard displays in the place of iframe in sencha touch


I am using cordova 1.8 and sencha touch 2.2.1.My problem is when I click on a textfield it displays keyboard instead of iframe.

This is my sencha code:

onfocus : function(){

Ext.getCmp('toolid').hide();

Ext.getCmp('crperid').hide();

Ext.getCmp('eventcvideoid').hide();

    Ext.getCmp('sqlbacklbl').show();
         //   Ext.getCmp('dattimepanelid').setHtml('<iframe id="dtid" src="http://example.com</iframe>');

      // frame.contentWindow.scrollTo(0, 1000); 
      Ext.getCmp('dattimepanelid').show();

Solution

  • Use this code to hide the keyboard

    var activeElement = document.activeElement;
    
    activeElement.setAttribute('readonly', 'readonly'); // Force keyboard to hide on input field.
    
    activeElement.setAttribute('disabled', 'true'); // Force keyboard to hide on textarea field.
    
    Ext.defer(function() {
    
    activeElement.blur();
            // Remove readonly attribute after keyboard is hidden.
    
    activeElement.removeAttribute('readonly');
    
    activeElement.removeAttribute('disabled');
    
       if(callback) {
    
         callback.call(scope);
    
     }
    
    }, 100);