0

我有一个 ContentPane 定义如下:

<div id="searchResultsContentPane" data-dojo-type="dijit.layout.ContentPane" data-dojo-props='splitter:false, region:"center"'></div>

当按下另一个 ContentPane 中的按钮时,我试图动态设置 href:

var searchResultsContentPane = dijit.byId("searchResultsContentPane");
searchResultsContentPane.set("href", "modules/content_panes/callrecords.php");

由于某种原因,这似乎不起作用。内容窗格闪烁加载然后变回白色,FireBug 没有给我可用的信息。这就是它所显示的全部内容:

在此处输入图像描述

如果您看不懂它以红色显示:

获取http://cdr.homelinux.net:10001/Mike/modules/content_panes/callrecords.php

如果我将其设置为 html 作为 data-dojo-props 属性, callrecords.php 加载就很好。

谢谢

4

1 回答 1

0

页面令人耳目一新。使用以下代码正确加载内容窗格。

function sendSearchForm() {
            // format taken from http://dojotoolkit.org/reference-guide/1.7/dojo/xhrPost.html
            var form = dojo.byId("search_form");

            dojo.connect(form, "onsubmit", function(event) {
                dojo.stopEvent(event);

            var xhrArgs = {
                form: dojo.byId("search_form"),
                handleAs: "text",
                load: function(data){
                    loadAdvancedSearchResultsTable();
                    //var searchResultsContentPane = dijit.byId("searchResultsContentPane");
                    //searchResultsContentPane.set("href", "modules/content_panes/test_module.html");
                },
                error: function(error){
                    // TODO Handle errors
                }
              }
              // Call the asynchronous xhrPost
              //dojo.byId("response").innerHTML = "Form being sent..."
              var deferred = dojo.xhrPost(xhrArgs);
            });
        }
        dojo.ready(sendSearchForm);
于 2012-06-28T20:53:19.747 回答