0

いくつかの Dojo ウィジェットを含むレイアウトをセットアップしましたが、コンテンツ ペインを含むサイド メニューをデフォルトですべて閉じたいと考えています。何が起こるかというと、最初のコンテンツ ペインが開いたままになり、他のコンテンツ ペインが消えてしまいます。ちなみに、コンテンツペインはすべてアコーディオンコンテナ内にあります

<!doctype html>
<html lang="en" dir="ltr">
<head>
   <script src=
     "https://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js"
      djConfig="parseOnLoad: true"></script>


    <title>Dijit Template</title>
    <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/
      libs/dojo/1.5/dijit/themes/claro/claro.css" />
    </head>
    <body class="claro">
    <div style="width: 535px; height: 290px">
    <div dojoType="dijit.layout.BorderContainer" style="width: 100%; 
     height: 100%;">
    <div dojoType="dijit.layout.ContentPane" region="top" splitter="true">
        This is the content in the top section.
    </div>
    <div dojoType="dijit.layout.ContentPane" region="left" style="width: 100px;" 
      splitter="true">
        <div dojoType="dijit.layout.AccordionContainer"minSize="20" 
         style="width:  300px;" id="leftAccordion" region="leading" splitter="true">
         <div dojoType="dijit.layout.ContentPane" title="HOME">
          </div>
         <div dojoType="dijit.layout.ContentPane" title="INSTANCES">
          <div dojoType="dijit.TitlePane" title="Reader01">
                    </div>
       </div>
      <div dojoType="dijit.layout.ContentPane" title="DISCOVERY">
                  </div>
     </div><!-- end AccordionContainer -->
    </div>
    <div dojoType="dijit.layout.ContentPane" region="center" splitter="true">
        This is the content in the center section.
    </div>
    <div dojoType="dijit.layout.ContentPane" region="right" 
            style="width: 100px;"splitter="true">
        This is the content in the right section.
    </div>
    <div dojoType="dijit.layout.ContentPane" region="bottom" splitter="true">
         This is the content in the bottom section.
     </div>
 </div>
  </div>




</body>
</html>​
4

1 に答える 1

1

AccorionContainer の addChild 関数では、次の行が表示されます

this.layout();
if(!this.selectedChildWidget){
   this.selectChild(child);
}

子は常に選択されますが、ここに線を引きましょう

これを試してみてください。これはコードのスニペットであり、他のすべてのコンテンツペイン (ホーム、インスタンスなど) の上に空の子を追加します。これを選択済みに設定し、onload を非表示にします

        <div dojoType="dijit.layout.AccordionContainer"  
         style="width:  300px;" id="leftAccordion" region="leading" splitter="true">
            <script type="dojo/connect" events="onLoad">
                // at this point, children have not yet been added, release and let widget complete workflow
                var acc_container = this;
                setTimeout(function() {
                   // get the child, then hack to get its wrapper (includes titlenode)
                   var hiddenChild = acc_container.getChildren()[0].id+"_wrapper"
                   hiddenChild = dijit.byId(hiddenChild);
                   acc_container._hideChild(hiddenChild);
               }, 100);
            </script>

         <div dojoType="dijit.layout.ContentPane" dojoProps="selected:true" selected="true">
          </div>
于 2012-05-04T16:51:51.253 に答える