0

当我单击第二个选项卡时,我希望加载 callrecords.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>

呼叫记录.html

<h1>Tab 2</h1>

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

1 回答 1

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')

看看这是否有效。dojo 1.7 语法是:

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

如果程序化设置有效,那么你就知道它只是你的标记中的一些东西。


更新:为了将来参考,Dojo 1.6 设置类型的方式是:dojo-type="dijit.layout.ContentPane"

于 2012-06-20T16:29:50.630 回答