如何在宏代码中打开一个自定义的对话框,请参考如下示例。
注意:该代码适用于 smartbi v7版本
示例代码:
function main(simpleReport, simpleReportContext) { var dialogFactory = jsloader.resolve("freequery.dialog.dialogFactory"); var dialogConfig = { title: "test open report", size: dialogFactory.size.LARGE, dialogType: "modeless", fullName: "freequery.dialog.BaseDialogEx", closeBeforeCallback: true }; var data = {}; dialogFactory.showDialog(dialogConfig, data, doOnCloseDlg, this); setTimeout(function() { openReport() }, 500); } function doOnCloseDlg(isOk) { //关闭对话框后的回调事件 //alert(isOk); } function openReport() { // 替换成你的目标资源的url var url = 'http://192.168.1.16:19090/smartbi/vision/openresource.jsp?resid=I40288190015b8ab58ab5d18b015b8af5608e083f&refresh=true&user=admin&password=admin'; var domutils = jsloader.resolve('freequery.lang.domutils'); var elem = window.dialog.dialogBody; var btnOK = window.dialog.btnOK; var btnCancel = window.dialog.btnCancel; btnOK.style.display = 'none' btnCancel.value = '关闭(C)'; elem.innerHTML = '<iframe src="' + url + '" width="100%" height="100%" border="0" frameSpacing="0" frameBorder="0"></iframe>' }
示例效果: