0

我可能在做一些非常错误和愚蠢的事情,但我似乎无法弄清楚这一点。我有一个按钮,当按下它时,我想设置一个不同的内容窗格来运行并显示一个 .php 文件。当我按下按钮时,以下内容不执行任何操作:

dojo.addOnLoad(
        function() {
            dojo.connect(dojo.byId("mainPanel"), "onclick", callRecordsPressed);
});

function callRecordsPressed() {
       digit.byId("mainPanel").setContent('modules/content_panes/callrecords.php'); 
}

我也尝试过运行 get 但这也无济于事:

        function callRecordsPressed() {
            digit.byId("mainPanel").setContent(alert(dojo.xhrGet({
                url: 'modules/content_panes/callrecords.php',
                load: callRecordsCallBack,
                error: callRecordsError
            })));

        }

        // Function that will be called when the find user button is pressed
        function callRecordsCallBack(data, ioArgs){
        }

        function callRecordsError(data, ioArgs){
            alert('Error when attempting load call records!');
        }

我在哪里定义内容窗格:

        <div class="centerPanel" data-dojo-type="dijit.layout.ContentPane"
             data-dojo-props="region: 'center'" id="mainPanel" >

            This is the right pane

        </div>

我也尝试过 setHref(..) ,但这似乎也没有效果。有没有固定的方法来做到这一点?

谢谢

4

1 回答 1

1

如果您的内容窗格确实已创建,这就是您做错了什么

函数 callRecordsPressed() { digit.byId("callRecordsButton").setContent(alert(dojo.xhrGet({ url: 'modules/content_panes/callrecords.php', 加载: callRecordsCallBack, 错误: callRecordsError })));

    }

应该看起来像这样:

function callRecordsPressed() {
        digit.byId("callRecordsButton").set('href', 'modules/content_panes/callrecords.php');
    }
于 2012-05-19T22:19:09.350 回答