2012-06-20 61 views
0

當我單擊第二個選項卡時,我想要加載callrecords.html代碼,但它不加載任何內容,並且該窗格保持空白。我有點小白,似乎無法弄清楚爲什麼會發生這種情況。Dojo選項卡未加載外部html

另外一個側面的問題。爲什麼有些代碼示例說dojoType,而其他代碼則使用data-dojo-type。

<body class="tundra"> 

    <div class="formContainer" dojoType="dijit.layout.TabContainer" > 

     <div dojoType="dijit.layout.ContentPane" title="Advanced Search"> 
      <label for="first_name">First Name:</label> 
      <input type="text" name="first_name" id="first_name" 
        size="30" /><br/> 
      <label for="last_name">Last Name:</label> 
      <input type="text" name="last_name" id="last_name" 
        size="30" /><br/> 
      <label for="middle_initial">Middle Initial:</label> 
      <input type="text" name="middle_initial" id="middle_initial" 
        size="1" /><br/> 
     </div> 

     <div dojoType="dijit.layout.ContentPane" title="Call Records" data-dojo-props='href:"modules/content_panes/callrecords.html", refresnOnShow:true'></div> 

     <div dojoType="dijit.layout.ContentPane" title="Phones"> 
      <label for="home_phone">Home Phone:</label> 
      <input type="text" name="home_phone" id="home_phone" 
        size="30" /><br/> 
      <label for="work_phone">Work Phone:</label> 
      <input type="text" name="work_phone" id="work_phone" 
        size="30" /><br/> 
      <label for="cell_phone">Cell Phone:</label> 
      <input type="text" name="cell_phone" id="cell_phone" 
        size="30" /><br/> 
     </div> 

    </div> 

</body> 

callrecords.html

<h1>Tab 2</h1> 

<p>I am tab 2. I was loaded externally as well.</p> 
+1

數據道場型是新的HTML5語法。一些例子使用舊的語法,一些是html5。 http://dojotoolkit.org/features/1.6/html5data-attributes –

+0

非常感謝你。這工作完美。 – FuegoFingers

回答

1

夫婦的事情。

1)您有錯別字:refresnOnShow。應該是refreshOnShow

2)data-dojo-props只適用於Dojo> 1.7。你在使用dojo 1.7或更高版本嗎?如果沒有,那將無法工作。

我的建議是嘗試以編程方式設置窗格的href:

dijit.byId('tab2').attr('href', 'modules/content_panes/callrecords.html') 

,看看是否有效。道場1.7語法是:

require(["dojo/dom-attr"], function(domAttr){ 
var t = dijit.byId('tab2'); 
domAttr.set(t,'href','http://localhost:8080/vewpon/') 
}) 

如果編程設定的工作,那麼你知道它只是在你的標記的東西。


更新:以供將來參考,設置型的道場1.6的方法是:dojo-type="dijit.layout.ContentPane"

+0

O geeze。這就是我深夜編寫代碼的原因。我使用的是1.6,因爲我在查找文檔和博客時遇到了麻煩。你如何在1.6上設置屬性?我在這裏看到http://dojotoolkit.org/documentation/tutorials/1.6/dijit_layout/,他們使用data-dojo-props在一個1.6項目上下三分之一左右... – FuegoFingers

+0

不要緊,我現在正在工作。看起來它需要成爲data-dojo-props的HTML5文檔,而不是Dojo 1.7。 – FuegoFingers

相關問題