base-layout.js 1.43 KB
/* global slickgrid */

var layout = {
    adjust_grid_size: function() {
        "use strict";
        if (window.slickgrid && slickgrid.element) {
            slickgrid.element.height(
                $('#left').innerHeight() - $('#search-panel').innerHeight());
            if (slickgrid.grid) {
                slickgrid.grid.resizeCanvas();
                slickgrid.grid.autosizeColumns();
            }
        }
    },

    adjust_tabs: function() {
        "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());
    }
};

$(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.splitter) {
        left.bind('resize', function (e) {
            layout.adjust_grid_size();
            e.stopPropagation();
        });
        $('#right').bind('resize', function (e) {
            layout.adjust_tabs();
            e.stopPropagation();
        });
        content.splitter({
            type: 'v',
            minLeft: 200, sizeLeft: 390, minRight: 100,
            resizeToWidth: true
        });
    }
});