The "Ext.Viewport.on('painted'"-solution gave me scrolling problem. The whole page could not be scrolled after orientation change, because viewport height would then be larger than window height.
(Ext.Viewport.getHeight() will not be the same as Ext.Viewport.getWindowHeight() after orientation change.)
Made a work around using overidden input:
Create a file app/overrides/field/Input.js
Ext.define('myApp.overrides.field.Input', {
override: 'Ext.field.Input',
initialize: function() {
var me = this;
// Solves problem that screen keyboard hides current textfield
if (Ext.os.is.Android) {
this.element.on({
scope : this,
tap : 'onTap',
});
}
me.callParent();
},
onResize: function(input) {
var me = input;
//if input is not within window
//defer so that resize is finished before scroll
if(me.element.getY() + me.element.getHeight() > window.innerHeight) {
Ext.Function.defer(function() {
me.element.dom.scrollIntoView(false);
}, 100);
}
},
// Solves problem that screen keyboard hides current textfield in e.g. MyTimeRowForm
//old solution with Viewport.on('painted', gave scroll problem when changeing orientation
onTap: function(e) {
me = this;
window.addEventListener( "resize", function resizeWindow () {
me.onResize(me);
window.removeEventListener( "resize", resizeWindow, true );
}, true );
},
});
And add it to app.js
requires: ['myApp.overrides.field.Input']