zoukankan      html  css  js  c++  java
  • 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: '经销商名称',  parseInt($(this).width() * 0.2)},
                        {field: 'goodscount', title: '新增sku数',  parseInt($(this).width() * 0.1),sortable:true,sorter:numberSort},
                        {field: 'upgoodscount', title: '在售sku数',  parseInt($(this).width() * 0.1),sortable:true,sorter:numberSort},
                        {field: 'goodsSaleCount', title: '下单商品数',  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}
    ]}
  • 相关阅读:
    接口的故事
    Bash CookBook(一)--基础
    Spring学习笔记(四)--MVC概述
    Spring学习笔记(三)--Convert System设计
    java web框架发展的新趋势--跨界轻型App
    由Strurts2漏洞引开谈谈web代码安全问题
    Java线程同步之一--AQS
    Android Studio 0.4 + PhoneGap 3.3 开发环境的搭建
    redis的多线程
    原电商设计框架
  • 原文地址:https://www.cnblogs.com/qiao20/p/10437458.html
Copyright © 2011-2022 走看看