示例说明
通过灵活分析显示快捷工具栏并添加按钮宏代码添加在灵活分析报表上的快捷工具栏,在打印预览界面会显示出来
可以通过宏代码在打印预览界面将快捷工具栏隐藏
设置步骤
- 在资源定制中,创建一张灵活分析报表。
- 选中灵活分析,右键选择 编辑宏 进入报表宏界面。
- 在报表宏界面新建客户端模块,在弹出的新建模块对话框中选择对象为simpleReport;事件为onRenderTable;并把下面宏代码复制到代码区域。
宏类型
宏类型 | 宏对象 | 宏事件 |
---|---|---|
ClientSide | simpleReport | onRender |
宏代码
function main(simpleReport, simpleReportContext) { //simpleReport.setShowShotCut(true); //必须重写 simpleReport._szsj_setShowShotCut = simpleReport.setShowShotCut; simpleReport.setShowShotCut = function(flag) { this._szsj_setShowShotCut(flag); if (this.shortcut.style.display == "block") { this.shortcut.style.display = ""; } } hideOnPrint(simpleReport.shortcut); hideOnPrint(simpleReport.navigationLay); //打印隐藏分页 } function hideOnPrint(elem) { if (!elem) return; //不加这一句,通过css覆盖不了内联样式 if (elem.style.display == "block") { elem.style.display = ""; } var hideClass = "print-hidden"; if (!domutils.hasClassName(hideClass)) { domutils.addClassName(elem, hideClass); } }
资源下载:migrate.xml