提示:本文档的示例代码仅适用于本文档中的示例报表/场景。若实际报表/场景与示例代码无法完全适配(如使用功能不一致,或多个宏代码冲突等),需根据实际需求开发代码。
问题描述
如何屏蔽即席查询报表的导出类型
解决方案
V9可参考如下宏代码:
代码块 | ||
---|---|---|
| ||
//类型:ClientSide
//对象:simpleReport
//事件:onRender
function main(simpleReport, simpleReportContext) {
if (!simpleReport._initExportMenu_new) {
//旧方法备份
simpleReport._initExportMenu_new = simpleReport.initExportMenu;
//重写方法
simpleReport.initExportMenu = function() {
debugger;
simpleReport._initExportMenu_new();
simpleReport.exportMenu.removeItem("TXT");
simpleReport.exportMenu.removeItem("CSV");
simpleReport.exportMenu.removeItem("MHT");
simpleReport.exportMenu.removeItem("PDF");
simpleReport.exportMenu.removeItem("WORD");
simpleReport.exportMenu.removeItem("EXCEL2007");
setTimeout(function() {
simpleReport.exportMenu.removeItem("DATAPACKAGE");
}, 5);
}
}
} |
提示:本文档的示例代码仅适用于本文档中的示例报表/场景。若实际报表/场景与示例代码无法完全适配(如使用功能不一致,或多个宏代码冲突等),需根据实际需求开发代码。
问题描述
如何屏蔽即席查询报表的导出类型
解决方案
可参考如下宏代码:
代码块 | ||
---|---|---|
| ||
//类型:ClientSide //对象:simpleReport //事件:onRender function main(simpleReport, simpleReportContext) { //旧方法备份 simpleReport._initExportMenu_new = simpleReport.initExportMenu; //重写方法 simpleReport.initExportMenu = function() { debugger; simpleReport._initExportMenu_new(); document.getElementById("TXT").style.display = "none";//屏蔽导出TXT document.getElementById("CSV").style.display = "none";//屏蔽导出CSV document.getElementById("MHT").style.display = "none";//屏蔽导出HTML document.getElementById("PDF").style.display = "none";//屏蔽导出PDF document.getElementById("WORD").style.display = "none";//屏蔽导出WORD document.getElementById("EXCEL2007").style.display = "none";//屏蔽导出EXCEL setTimeout(function() { document.getElementById("DATAPACKAGE").style.display = "none";//屏蔽导出数据分析包 }, 5); } } |