easyui datagrid 顯示 footer


1、設置 showFooter為true

$grid = $dg.datagrid({
               // fit: true,
                //fitColumns: true,
               // pagination: false,
              //  pageSize: 20,
               // pageList: [20, 40, 60, 80, 100],
                showFooter:true,  
                scrollbarSize:0,
                border: true,
                striped: true,
                singleSelect: false,
                selectOnCheck: true,
                checkOnSelect: true,
                remoteSort:false,
                rownumbers : false,//不顯示序號
                method:'get',
                columns: [[{field: 'companyname', title: '經銷商名稱', width: parseInt($(this).width() * 0.2)},
                    {field: 'goodscount', title: '新增sku數', width: parseInt($(this).width() * 0.1),sortable:true,sorter:numberSort},
                    {field: 'upgoodscount', title: '在售sku數', width: parseInt($(this).width() * 0.1),sortable:true,sorter:numberSort},
                    {field: 'goodsSaleCount', title: '下單商品數', width: parseInt($(this).width() * 0.1),sortable:true,sorter:numberSort}
                ]],
                onBeforeLoad: function (param) {
                    try {
                        let row = $(this).datagrid('getSelected');
                        let index = $(this).datagrid('getRowIndex', row);
                        row_key = index;
                    } catch (err) {
                        console.log(err);
                    }

                },
              
                onClickCell: function (index, field, value) {
                    $(this).datagrid('clearSelections');
                },
                onLoadSuccess: function (data) {
                    $(this).datagrid('checkRow', row_key);
                },
                toolbar: '#tb'
            });

 

2、json數據,主要是footer 數組對象

{"total":9,"rows":[
{"id":1,"name":"Chai","price":18.00},
{"id":2,"name":"Chang","price":19.00},
{"id":3,"name":"Aniseed Syrup","price":10.00},
{"id":4,"name":"Chef Anton's Cajun Seasoning","price":22.00},
{"id":5,"name":"Chef Anton's Gumbo Mix","price":21.35},
{"id":6,"name":"Grandma's Boysenberry Spread","price":25.00},
{"id":7,"name":"Uncle Bob's Organic Dried Pears","price":30.00},
{"id":8,"name":"Northwoods Cranberry Sauce","price":40.00},
{"id":9,"name":"Mishi Kobe Niku","price":97.00}
],"footer":[
{"name":"Total","price":282.35},
{"name":"Average","price":31.37}
]}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM