Your IP : 18.219.40.177
/**
* FieldHeight module
* @param {object} window global object
* @param {function} $ jQuery library
* @param {object} EventMgr EventMgr library
* @param {object} App Application
* @param {object} ScrollHandler Scrollbar library
*/
App.FieldHeight = function(window, $, EventMgr, App, ScrollHandler) {
'use strict';
function init() {
EventMgr.bind('appendForm', checkFieldForClass);
}
function checkFieldForClass(e, data) {
var tabId = data.tabId;
setTimeout(function() {
$('#form-wrapper-' + tabId).find('.i-control__fullwidth').each(function() {
var availableHeight = $('#form-scroll-' + tabId).height(),
hasButtons = $('#' + tabId + '-buttons').length;
setHeight(this, availableHeight, hasButtons);
});
});
}
function setHeight(elem, height, hasButtons) {
//buttons height(52) + margin bottom(20) + padding row (5) + tbody(2) + td padding (2) + resizer (5) + control border (2)
var MAGICNUMBER = 37,
BUTTONHEIGHT = 52,
height = height - MAGICNUMBER;
if (hasButtons) {
height -= BUTTONHEIGHT;
}
if (elem) {
elem.setAttribute('height', height + 'px');
}
}
var api = {
init: init
};
return api;
}(window, $, EventMgr, App, ScrollHandler);