base-layout.js 1.38 KB
var layout = {};

function adjust_grid_height() {
  "use strict";
  $('#scroll').jqGrid(
    'setGridHeight',
    $('#left').height() - 25 - $('#search-panel').height());
}

function adjust_grid_width() {
  "use strict";
  $('#scroll').jqGrid('setGridWidth', $('#left').width() - 2, true);
}

layout.adjust_grid_width = adjust_grid_width;

function adjust_grid_size() {
  "use strict";
  adjust_grid_height();
  adjust_grid_width();
}

function adjust_tabs() {
  "use strict";
  var right = $('#right');
  var height = right.height() - right.find('.ui-tabs-nav').height() - 35;
  right.find('.ui-tabs-panel').height(height);
  right.width(
    $('#content').width() - $('#left').width() - $('.vsplitbar').width());
}
layout.adjust_tabs = adjust_tabs;

$(function() {
  "use strict";
  var content = $('#content'), left = $('#left');
  content.height($(window).height() - $('#main_menu').height());
  $(window).resize(function() {
    content.height($(window).height() - $('#main_menu').height());
    if ($.fn.jqGrid) {
      adjust_grid_height();
    }
  });
  if ($.fn.splitter) {
    left.bind('resize', function(e) {
      adjust_grid_size();
      e.stopPropagation();
    });
    $('#right').bind('resize', function(e) {
      adjust_tabs();
      e.stopPropagation();
    });
    content.splitter({
      type: "v",
      minLeft: 200, sizeLeft: 390, minRight: 100,
      resizeToWidth: true
    });
  }
});