【问题标题】:JavaScript DevExtreme datagrid group footerJavaScript DevExtreme 数据网格组页脚
【发布时间】:2018-04-19 06:10:09
【问题描述】:

我有数据网格,其中我有一个特定列的自定义单元格模板。 我还将数据与特定列分组,并在组页脚显示某些列的组摘要。

我的问题是我没有分配任何组摘要的自定义单元格模板列在页脚显示单元格模板。 请检查codepen链接以了解问题

https://codepen.io/aasiph/pen/qYBVMd

$("#gridContainer").dxDataGrid({
        dataSource: orders,
        keyExpr: "ID",
        selection: {
            mode: "single"
        },
        columns: [{
                dataField: "OrderNumber",
                width: 130,
                caption: "Invoice Number"
            }, {
                dataField: "OrderDate",
                width: 160,
                dataType: "date",
            }, {
                dataField: "Employee",
                groupIndex: 0
            }, {
                caption: "City",
                dataField: "CustomerStoreCity"
            }, {
                caption: "State",
                dataField: "CustomerStoreState",
            }, {
                dataField: "SaleAmount",
                alignment: "right",
                format: "currency"
            }, {
                dataField: "TotalAmount",
                alignment: "right",
                format: "currency"
            },{
                     caption: "",
                     allowGrouping: false,
                     allowFiltering: false,
                     allowSorting: false,
                     cellTemplate: function (container, options) {
                         $('<div><a href="#'+options.data.OrderNumber+'">View</a></div>')
                             .appendTo(container);
                     }
                 }
        ],
        sortByGroupSummaryInfo: [{
            summaryItem: "count"
        }],
        summary: {
            groupItems: [{
                column: "OrderNumber",
                summaryType: "count",
                displayFormat: "{0} orders",
            }, {
                column: "SaleAmount",
                summaryType: "max",
                valueFormat: "currency",
                showInGroupFooter: false,
                alignByColumn: true
            }, {
                column: "TotalAmount",
                summaryType: "max",
                valueFormat: "currency",
                showInGroupFooter: false,
                alignByColumn: true
            }, {
                column: "TotalAmount",
                summaryType: "sum",
                valueFormat: "currency",
                displayFormat: "Total: {0}",
                showInGroupFooter: true
            }]
        }
    });
});

我不希望单元格模板显示在组页脚中。

【问题讨论】:

    标签: datagrid devextreme


    【解决方案1】:
    cellTemplate: function (container, options) {
                        if(options.rowType == "groupFooter") return;
                         $('<div><a href="#'+options.data.OrderNumber+'">View</a></div>')
                             .appendTo(container);
                     }
    

    if(options.rowType == "groupFooter") 返回;解决了这个问题。问题已通过 DevExpress 支持解决。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-01-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多