PDA

View Full Version : find if browser is maaximised in EXTJS



rajuarien
17 Sep 2013, 11:52 AM
I resize the northPanel content based in windows resize. This works like a charm but the problem is when i Maximise on the browser, the last headerScrollHeight is retained since the windows is not yet been redrawn as such the northpanel has a gap vertically since the Height was incorrect. To work around this i want to reset the scrollHeight to its original height. To achieve the same, I need to find out when the browser maximised button was clicked.

Tried this
console.log('screen.availHeight > ' + screen.availHeight);
console.log(' window.screenX > ' + window.height); //This is coming as undefined in this handler,

Ext.EventManager.onWindowResize(function () {
var northPanel = Ext.getCmp('north_panel');
if (northPanel != null) {
if (document.getElementById('header') != null) {
var headerScrollHeight = document.getElementById('header').scrollHeight;
try {
northPanel.expand(false);
northPanel.setHeight(headerScrollHeight);
// northPanel.findParentByType("viewport").syncSize();
northPanel.findParentByType("viewport").doLayout();
} catch(err) {
//console.log('error ' + err);
}
}
}
});

ettavolt
18 Sep 2013, 12:10 AM
Instead of manually changing the height try to achieve same thing with layouts.

rajuarien
19 Sep 2013, 1:40 PM
Handled the windows maximised condition and setHeight(<original height >) and called doLayout()

Ext.EventManager.onWindowResize(function () {

if (window.screenLeft == 0) //windows maximised

=P~