0

我在 Kendo 详细网格中有很多行,我试图在外部网格的数据单元格中显示详细行的总和。有什么办法可以做到吗?

4

1 回答 1

0

嗨,我在此示例中为您创建了一个示例,我将第一个网格的列总数显示到第二个网格的单元格中。

代码:-

//calucalte the total of value column of first grid and create new data
var total=0;
var data=$("#grid").data("kendoGrid").dataSource.data();
$.each(data,function(i,row)
       { 
               total+=row.value; 
       });

//create dataSource for new grid
var source=[{"total":total}];
//create new grid here
$("#grid2").kendoGrid({
    dataSource: source,

    schema: {
        model: {
            id: "id",
            fields: {
                total: { type: "number", editable: false },

            }
        }            
    }, 
});

工作示例:- http://jsfiddle.net/mga6f/287/

谢谢

于 2014-08-04T15:57:22.560 回答