Created
June 24, 2013 08:18
-
-
Save teltploek/5848526 to your computer and use it in GitHub Desktop.
Guld til Simon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Resize the controls in the west panel to fit area. | |
_______________ | |
| | | |
| AccountInfo | | |
|_______________| | |
| | | |
| MetraCare | | |
|_______________| | |
We want the height of MetraCare = Total height available - AccountInfo height. | |
The way we'll achieve this is to set the account info to the height of its contents height, | |
and then use the Ext.getCmp (translates to get component) to set the height of the west-panel | |
to the remaining height of the entire column. */ | |
function resizeWestPanel() { | |
var containingArea = $('#west-panel-acc', window.parent.document), // the entire west panel | |
containerMetraCare = $('#west-panel', window.parent.document), // the metracare part of the panel | |
accountInfoArea = $('.AccountInfo'); // the account info content from this .ascx | |
var totalHeightAvailable = parseInt(containingArea.height()), | |
heightConsumedByAccountInfo = parseInt(accountInfoArea.height()) + 25; | |
$('#west-panel-acc', window.parent.document).find('iframe').height(heightConsumedByAccountInfo); // resize iframe to have height of accountinfo content | |
$('#AccountInfoContainer', window.parent.document).closest('.x-panel-body').height(heightConsumedByAccountInfo); | |
containerMetraCare.css('top', heightConsumedByAccountInfo); // set the top offset of the metracare container to be the height of accountinfo | |
window.parent.Ext.getCmp('west-panel').setHeight(totalHeightAvailable - heightConsumedByAccountInfo); // use Ext.getCmp to set height to the remaining height of the west panel | |
} | |
$(document).ready(function () { | |
// when parent window is resized we want to run our resizing of the west panel as well | |
$(window.parent).on('resize', function () { | |
setTimeout(function () { | |
resizeWestPanel(); | |
}, 200); | |
}); | |
/* We need a small time-out before we start measuring the elements in the west panel, due to | |
controls being injected at runtime. These needs to be done with the injection, when we start | |
height adjustments. */ | |
setTimeout(function () { | |
resizeWestPanel(); | |
}, 200); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment