jqGrid列的统计

    $("#List").jqGrid({    
                   url: "${pageContext.request.contextPath}/cbfx/getCbhzList.do",    
                   datatype: "json",    
                   mtype: 'GET',    
                   colNames:["成本类别","费用","去年同期费用","备注"],    
                   colModel:[    
                       {name: "cblb", align: 'center', width:120},    
                       {name: "fy", align: 'center', width:100},    
                       {name: "qntqFy", align: 'center', width:100},    
                       {name: "", align: 'center', width:100}    
                   ],    
                   rownumbers:true,    
                   rowNum: 10,    
                   page: 1,    
                   footerrow:true,    
            gridComplete: completeMethod,    
                   total: 15,    
                   rowList: [10, 20, 30],    
                   pager: "#cbhzPager",    
                   viewrecords: true,    
                   height: "auto",    
                   autowidth: true,    
                   gridview:true,    
                   autoencode: true,    
                   multiselect: false,    
                   caption: "标题"    
               }).navGrid("#cbhzPager", {    
                   refresh: false,    
                   edit: false,    
                   add: false,    
                   del: false,    
                   search: false    
               });    
                   
               /*统计功能 */    
            function completeMethod(){    
                   var sum_Fy=$("#List").getCol('fy',false,'sum');    
                   var sum_qntqFy=$("#List").getCol('qntqFy',false,'sum');    
                   $("#List").footerData('set', { "cblb": '合计', fy: sum_Fy, qntqFy: sum_qntqFy });    
               }    
           });    

 

posted @ 2017-03-30 14:10  你也很优秀  阅读(3533)  评论(0编辑  收藏  举报