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;
        }

 

posted @ 2017-04-21 10:54  人生为卒  阅读(724)  评论(0编辑  收藏  举报