隐藏内容窗格后自动调整大小面板

时间:2014-09-22 13:20:24

标签: javascript layout dojo

这对我来说不起作用,我的情况(Dojo 1.7):

function showWidthElm(elm_div_zone_id,show) {

var toggler = new dojo.fx.Toggler({
    node: "leftAccordionElm"+elm_div_zone_id
});

if(show==true){
    toggler.show();
    dijit.byId("center_panel_elm").resize();
}
else{
    toggler.hide();
    dijit.byId("center_panel_elm").resize();
}

}

关闭动作后我需要隐藏左手风琴并仅显示中心区域(dijitBorderContainer-child)。它的隐藏性很好但不会调整大小。

1 个答案:

答案 0 :(得分:0)

找到解决方案,将show()和hide()与样式结合使用并调整大小:

    function showWidthElm(elm_div_zone_id,show) {

    var toggler = new dojo.fx.Toggler({
        node: "leftAccordionElm"+elm_div_zone_id
    });

    var borderContainer = dijit.byId('leftAccordionElm'+elm_div_zone_id);
    var borderContainer2 = dijit.byId('center_panel_elm');
    var borderContainer3 = dijit.byId('center_panel_tab_cont');

    if(show==true){
        toggler.show();
        dojo.setStyle(borderContainer.domNode, 'width','280px');
        dojo.setStyle(borderContainer2.domNode, 'width','80%');
        borderContainer3.resize();
    }
    else{
        toggler.hide();
        dojo.setStyle(borderContainer.domNode, 'width','0px');
        dojo.setStyle(borderContainer2.domNode, 'width','100%');
        borderContainer3.resize();
    }
}