2

誰かが私を助けることができますか?BorderContainer 内に配置された ContentPane の自動サイズ変更を実装したいと思います。簡単なテスト ケースは次のとおりです: http://jsfiddle.net/3dft2/1/ この場合、ContentPane 内に TitlePane があります (ただし、一般的には、内部の任意のコンテンツである可能性があります)。TitlePane をクリックすると (それが開きます => コンテンツの高さが変わります)、ContentPane のサイズをコンテンツのサイズに応じて自動変更したいと思います。つまり、スプリッターを移動したいと思います。これをアーカイブする方法は?コンテンツのサイズ (コンテンツの種類に関係なく) を監視し、このサイズが変更された場合に ContentPane のサイズを自動変更する方法は?

テストケース:

dojo.require("dijit.TitlePane");
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.layout.BorderContainer");
dojo.ready(function() {
     // create a BorderContainer as the top widget in the hierarchy
    var bc = new dijit.layout.BorderContainer({
        style: "height: 300px; width: 500px;"
    });

    var TitlePane = new dijit.TitlePane({
        title: 'title pane',
        open: false,
        content: "Collapse me!"        
    });

    // create a ContentPane as the left pane in the BorderContainer
    var cp1 = new dijit.layout.ContentPane({
        region: "top",
        style: "width: 100px",
        content: TitlePane,
        splitter: "true"
    });
    bc.addChild(cp1);

    // create a ContentPane as the center pane in the BorderContainer
    var cp2 = new dijit.layout.ContentPane({
        region: "center",
        content: "how are you?"
    });
    bc.addChild(cp2);

    // put the top level widget into the document, and then call startup()
    bc.placeAt(document.body);
    bc.startup();
});
4

1 に答える 1