easy-ui datagrid

时间:2023-03-08 16:42:48

Easy-ui引用
    <link href="css/EasyUI/themes/icon.css" rel="stylesheet" type="text/css" />
    <link href="css/EasyUI/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="css/EasyUI/demo.css" rel="stylesheet" type="text/css" />

<script src="js/jq/jquery-1.8.0.min.js" type="text/javascript"></script>
    <script src="js/EasyUI/jquery.easyui.min.js" type="text/javascript"></script>

$('#tt').datagrid({
            //标题
            title: 'Frozen Columns',
            //标题左上角的图标
            iconCls: 'icon-save',
            //宽高
            width: 1000,
            height: 250,
            //表头(title)上的工具栏
            //toolbar: '#aa',
            method: 'get',
            //最左边序号
            rownumbers: true,
            //选中单行(变成黄色)
            singleSelect: true,
            //锁定行(json中的foot)
            showFooter: true,
            //控制分页↓
            pageList: [10, 20, 50],
            collapsible: true,
            pagination: true,
            //控制分页↑
            loadMsg: "数据读取中......",
            url: 'datagrid_dataF.json',
         //锁定列(冻结列)
            frozenColumns: [[
                        { field: 'itemid', title: '操作', width: 40, formatter: function(value, row, index) {
                            var edit = "";
                            //                            if (row.editing) {
                            var del = "<a style=\"cursor:pointer\" onclick=\"delRow(" + index + ")\"><img src=\"image/cross.png\" alt=\"删除\" /></a>";
                            return edit + "&nbsp;&nbsp;" + del;
                            //                            }
                            //                            else {
                            //                                var del = "<a style=\"cursor:pointer\" onclick=\"delRow(" + index + ")\"><img src=\"~/image/cross.png\" alt=\"删除\" /></a>";
                            //                                return edit + "&nbsp;&nbsp;" + del;
                            //                            }
                        }
                        },

]],
            columns: [[
                        { field: 'chbm', title: '存货编码', align: 'center', width: 100 },
                        { field: 'chmc', title: '存货名称', align: 'center', width: 100 },
                        { field: 'ysdm', title: '颜色代码', align: 'center', width: 100 },
   { field: 'ysmc', title: '颜色名称', align: 'center', width: 100 },
   { field: 'dw', title: '单位', align: 'center', width: 100 },
   { field: 'sl', title: '数量', align: 'center', width: 100 },
   { field: 'hsdj', title: '含税单价', align: 'center', width: 100 },
   { field: 'hsje', title: '含税金额', align: 'center', width: 100 },
   { field: 'qsdj', title: '去税单价', align: 'center', width: 100 },
   { field: 'qsje', title: '去税金额', align: 'center', width: 100 },
   { field: 'se', title: '税额', align: 'center', width: 100 },
   { field: 'dlmc', title: '大类名称', align: 'center', width: 100 },
   { field: 'jh', title: '集合', align: 'center', width: 100 },
   { field: 'glspdm', title: '关联商品代码', align: 'center', width: 100 },
   { field: 'glspmc', title: '关联商品名称', align: 'center', width: 100 },
   { field: 'jj', title: '季节', align: 'center', width: 100 },
   { field: 'js', title: '结算', align: 'center', width: 100 }
                       ]]
        });

设置(冻结行)
   List<object> footer = new List<object>();
          footer.Add(new{列名1=数据1,列名2=数据2});