页面树结构
转至元数据结尾
转至元数据起始

示例说明

通过灵活分析显示快捷工具栏并添加按钮宏代码添加在灵活分析报表上的快捷工具栏,在打印预览界面会显示出来

可以通过宏代码在打印预览界面将快捷工具栏隐藏

 

设置步骤

  1. 在资源定制中,创建一张灵活分析报表。

  2. 选中灵活分析,右键选择 编辑宏 进入报表宏界面。

  3. 在报表宏界面新建客户端模块,在弹出的新建模块对话框中选择对象为simpleReport;事件为onRenderTable;并把下面宏代码复制到代码区域。

宏类型

宏类型宏对象宏事件
ClientSidesimpleReportonRender


宏代码

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

  • 无标签