Reputation: 861
Extjs 4.2, How i can ignore maxHeight
config when window maximized?
I want to make fullscreen window.
This's my demo code in jsfiddle.
Ext.onReady(function() {
Ext.create('Ext.window.Window',{
title: 'Hello',
maximizable: true,
width: 400,
height: 300,
maxHeight: 350
}).show();
});
Upvotes: 1
Views: 1542
Reputation: 46249
Ready for a major hack?
function realMaximize(){
if(this.maxInternal){
return;
}
if(this.maximized){
this.oldMaxHeight = this.maxHeight;
this.maxHeight = undefined;
this.maxInternal = true;
this.restore();
this.maximize();
this.maxInternal = false;
}else{
this.maxHeight = this.oldMaxHeight;
}
}
Ext.onReady(function() {
var w = Ext.create('Ext.window.Window',{
title: 'Hello',
maximizable: true,
width: 400,
height: 300,
maxHeight: 350
});
w.addListener('maximize',realMaximize);
w.show();
});
ugh! Horrible. What does it do? When it detects a maximize, it stores the current maximum height and removes it. Then it toggles the maximisation so that the UI updates to respect this new maximum (maybe there is a better way?). Finally, it has to set and check a flag or it would get in an infinite loop (maximize
calls the function again).
Going back to windowed isn't so hard; the remembered size must be OK, so we don't need to call the function recursively.
Upvotes: 1