检查Dojo的内容窗格是否可用
我需要以编程方式创建dojox.layout.ContentPane检查Dojo的内容窗格是否可用,dojo,Dojo,我需要以编程方式创建dojox.layout.ContentPane function constructContentPane(methodToBeCalled){ var testCntPane=new dojox.layout.ContentPane({ href: "some url", executeScripts: true, cleanConten
function constructContentPane(methodToBeCalled){
var testCntPane=new dojox.layout.ContentPane({
href: "some url",
executeScripts: true,
cleanContent: true,
onDownloadEnd: methodToBeCalled
}).placeAt("testContentPaneId");
testCntPane.startup();
}
这会将内容窗格放置在testContentPaneId中,并在创建内容窗格后调用methodToBeCalled方法
我有两个问题
如何检查内容窗格是否已创建?我尝试使用下面的代码进行检查
但这并不奏效。每次创建id为dojox_layout_ContentPane_0的内容窗格时。最后一位数字每次递增
这是将onComplete方法作为参数传递的正确方法吗?这就是我调用它的方式
有没有更好的办法?如何调用该方法?我尝试使用evalmethodToBeCalled,但没有成功。当您使用placeAt方法时,小部件将作为指定dom节点的子节点放置。我认为在您的情况下,应该将dom直接传递给内容窗格的构造函数
试着这样做:
var testCntPane=new dojox.layout.ContentPane({
href:"some url",
executeScripts:true,
cleanContent:true,
onDownloadEnd:methodToBeCalled
}, "testContentPaneId");
这还将确保内容窗格的id为testContentPaneId谢谢Danne。这对我很有帮助。如何调用作为参数传递的方法?我尝试了evalmethodName,但它不起作用;
constructContentPane(thisMethodWillBeCalled);
var testCntPane=new dojox.layout.ContentPane({
href:"some url",
executeScripts:true,
cleanContent:true,
onDownloadEnd:methodToBeCalled
}, "testContentPaneId");