easyui datagrid 添加统计行

 , onLoadSuccess: function (data) {

                        //添加“合计”列
                        DataLstdg.thisdg.datagrid('appendRow', {
                            DPPRTN: '<span class="subtotal">合计</span>',
                            Boxes: '<span class="subtotal">' + getAll("Boxes") + '</span>',
                            QTY: '<span class="subtotal">' + getAll("QTY") + '</span>',
                            ReceiveBox: '<span class="subtotal">' + getAll("ReceiveBox") + '</span>',
                            ReceiveQTY: '<span class="subtotal">' + getAll("ReceiveQTY") + '</span>'
                        });

                        //合计
                    }




    //指定列求和
        function getAll(colName) {
            var rows =DataLstdg.thisdg.datagrid('getRows');
            var total = 0;
            for (var i = 0; i < rows.length; i++) {
                total += parseFloat(rows[i][colName]);
            }
            return total;
        }
原文地址:https://www.cnblogs.com/lhlong/p/6742475.html