我想擦拭我的面板。但它不适用于<xp:panel>
组件,但适用于<div>
。
这是我的代码:
<xp:panel id="myPanel">This is my panel</xp:panel>
.....
dojo.style("myPanel", "height", "");
dojo.style("myPanel", "display", "block");
var wipeArgs = {
node: "myPanel"
};
dojo.fx.wipeOut(wipeArgs).play();
这也不起作用:
dojo.style("#{id:myPanel}", "height", "");
dojo.style("#{id:myPanel}", "display", "block");
var wipeArgs = {
node: "#{id:myPanel}"
};
dojo.fx.wipeOut(wipeArgs).play();
但这确实有效:
<div id="myDiv">This is my DIV</div>
.....
dojo.style("myDiv", "height", "");
dojo.style("myDiv", "display", "block");
var wipeArgs = {
node: "myDiv"
};
dojo.fx.wipeOut(wipeArgs).play();
那么如何让它适用于xp:panel?
答案 0 :(得分:1)
您需要在XSP.addOnLoad()
调用中运行Dojo代码,以便Dojo使用XPages生成的ID。
<xp:scriptBlock id="scriptBlock1">
<xp:this.value><![CDATA[
XSP.addOnLoad(function(){
dojo.style("#{id:myPanel}", "height", "");
dojo.style("#{id:myPanel}", "display", "block");
var wipeArgs = {
node: "#{id:myPanel}"
};
dojo.fx.wipeOut(wipeArgs).play();
});
]]></xp:this.value>
</xp:scriptBlock>
此外,如果您只想要一个div而不是一个附加了数据源的div,那么您可以使用xp:div
代替xp:panel
。