How to open extension library dialogue from client side javascript? I use
XSP.openDialog("#{id:myDialog}");
and it works perfect if I call it somewhere from xPage itself... But how do I open the dialogue from client side javaScript library?
Error: TypeError: dlg is undefined
I need to call it from a function in client side javascript library:
<a onclick="return showMyDialog();">Click it</a>
Thank you...
The "#{id:myDialog}"
is only interpreted if it is part of the actual XPage or Custom Controls. In Script Libraries no interpretation occurs.
I use CSJS libraries all the time with a model that declares a class like this:
if(!myDialog) {
var myDialog = {
id : "",
show : function() {
XSP.openDialog(this.id);
},
close : function() {
XSP.closeDialog(this.id);
}
}
}
Then on the XPage or Custom Control I put a scriptBlock like this:
<xp:scriptBlock>
<xp:this.value><![CDATA[
myDialog.id = "#{id:myDialog}";
]]></xp:this.value>
</xp:scriptBlock>