显示摘要行时 Syncfusion ejGrid 和 knockout.js 出现问题

Issue with Syncfusion ejGrid and knockout.js when displaying summary rows

我在使用 Syncfusion ejGrid 和 knockout.js 时遇到问题,显示组汇总值以及从空网格开始或向现有网格动态添加元素时。

网格设置:

    <div id="Grid" data-bind="ejGrid: {
               dataSource: dataSource, 
               allowGrouping:true, 
               allowSorting:true,
               columns: [{ field: 'OrderID', headerText: 'OrderID' },
                         { field: 'CustomerID', headerText: 'CustomerID' },
                         { field: 'ShipCity', headerText: 'ShipCity' },
                         { field: 'Freight', headerText: 'Freight' },
                         { field: 'EmployeeID', headerText: 'EmployeeID' }
                        ],                    
                showSummary: true,
                summaryRows: [
                            { summaryColumns: [{
                                summaryType: ej.Grid.SummaryType.Sum,
                                displayColumn: 'Freight',
                                dataMember: 'Freight',
                                prefix: 'Total: '
                                }],
                              showCaptionSummary: true,
                              showTotalSummary: false
                            }
                        ],                     
                    }">
    </div>

初始化:

var rows = [{
    OrderID: 10248,
    CustomerID: "VINET",
    ShipCity: "Reims",
    Freight: 11.61,
    EmployeeID: 4
}, {
    OrderID: 10250,
    CustomerID: "HANAR",
    ShipCity: "Charleroi",
    Freight: 65.83,
    EmployeeID: 2
}, {
    OrderID: 10251,
    CustomerID: "VICTE",
    ShipCity: "Reims",
    Freight: 41.34,
    EmployeeID: 1
}, {
    OrderID: 10252,
    CustomerID: "SUPRD",
    ShipCity: "Madrid",
    Freight: 51.3,
    EmployeeID: 3
}, {
    OrderID: 10253,
    CustomerID: "HANAR",
    ShipCity: "Rio de Janeiro",
    Freight: 58.17,
    EmployeeID: 3
}];

var source = ko.observableArray(rows);

var gridData = {
    dataSource: source
};

ko.applyBindings(gridData);

现在,下面的 jsfiddle 工作正常。也就是说,如果将 'CustomerID' 列拖到分组区域,则每个组(标记为 'Total')的汇总值显示良好:http://jsfiddle.net/zxw5sL2m/1/

现在,如果网格最初为空,然后添加行,则在 ej.web.all-latest.min.js 中使用 'TypeError: r is undefined' 加载时会失败:http://jsfiddle.net/zxw5sL2m/2/ (Also, this scenario doesn't work if knockout.js is removed: http://jsfiddle.net/ymgkf7r9/ )

类似地,如果网格最初是非空的,然后添加了行,它加载正常,但是当应用分组时,它失败并显示 'TypeError: y is null' in in in ej.web.all-latest.min.js: http://jsfiddle.net/zxw5sL2m/3/

如果不包括小组摘要,错误就会消失:http://jsfiddle.net/zxw5sL2m/4/

设置 showCaptionSummary: false 排序的工作,但是每次添加新行时(在任何分组之前),也会在底部添加一个新的摘要行而不是更新现有的摘要行:http://jsfiddle.net/zxw5sL2m/5/

此外,如果网格首先按列分组,然后添加行,则组会正确更新:http://jsfiddle.net/zxw5sL2m/8/ However, if the grid is originally ungrouped, and then grouped later on (either by the user or by calling the gridColumn method), when new rows are added to the grid, the grouping is lost (although strangely the group column name still appears in the group area in the header): http://jsfiddle.net/zxw5sL2m/9/

对于相关查询,我们已确认“在使用超时呈现行时使用启用标题摘要进行分组时抛出脚本错误”的问题是一个缺陷并记录了一个缺陷报告。此问题的修复程序将包含在我们计划于 2015 年 7 月底推出的第 2 卷 Service Pack 1 2015 中。

如果您有任何相关问题,请联系 Syncfusion 支持。

此致, 普拉珊娜·库马尔 N.S.V