【问题标题】:How to exclude the summaryType from the jqGrid while Exporting to excel导出到excel时如何从jqGrid中排除summaryType
【发布时间】:2021-09-07 05:49:12
【问题描述】:

我正在使用 jqGrid 版本 jqGrid JS - v5.3.0

这是 jqGrid 中的 Action Column,其中给出了 summaryType

{label: 'Action', name: 'ACTION', width: 60
     , summaryType: function (val, name, record) {
          return "Grand Total Printed:<br /> Grand Total Void:<br /> Grand Total Remaining :"                 
          }
},



        $("#headerJqGrid").jqGrid("exportToExcel", {
        title: 'Bl Print Control Header',
        includeLabels: true,
        includeGroupHeader: true,
        includeFooter: true,
        fileName: "HeaderSearchRecords.xlsx",
        maxlength: 40,
    });

这是使用的 exportToExcel 函数。当我导出到 excel

时,如何排除 summaryType

【问题讨论】:

    标签: jquery jqgrid export-to-excel


    【解决方案1】:

    我看到了两种可能性。 第一个是禁用应该出现摘要的页脚行:

        $("#headerJqGrid").jqGrid("exportToExcel", {
        ...
           includeFooter: false,
        ...
    });
    

    第二个是返回带有全局标志的空字符串,以防你绑定点击按钮导出到excel

    var export_summary= true;
    ....
    $("#mybutton").on("click", function(){
        export_summary= false;
        $("#headerJqGrid").jqGrid("exportToExcel", {...});
        export_summary= true;
    });
    

    在 summarType 中

     , summaryType: function (val, name, record) {
          return export_summary ? "Grand Total Printed:<br /> Grand Total Void:<br /> Grand Total Remaining :" ? "";                 
          }
    

    【讨论】:

    • 嗨托尼感谢您的努力,但我尝试了这两种可能性,但无法实现。你能用其他方法帮助我吗?
    • 我认为不应该演示第一个选项。只需将其设置为 false,您的页脚总数将不会显示。将为第二种情况准备一个示例。
    • @Benazir 这是一个example,导出到excel时不导出摘要类型
    • 嗨,托尼,在我的情况下,当调用 exportToexcel 函数时,网格未加载 export_summary = false 的值,因此我保留了相同的值。在我的情况下刷新colmodel的方法是什么
    • 要更新 colModel 项目使用 setColProp 方法。请参阅文档。
    猜你喜欢
    • 2023-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多