zoukankan      html  css  js  c++  java
  • easyui中datagrid用法,加载table数据与标题

    加载标题写法:

    多行标题:columns: [[
        columns: [[
                           { field: 'itemid', title: 'Item ID', rowspan: 2, 80, sortable: true },
                           { field: 'productid', title: 'Product ID', rowspan: 2, 80, sortable: true },
                           { title: 'Item Details', colspan: 4 }
                           ], [
                          { field: 'listprice', title: 'List Price', 80, align: 'right', sortable: true },
                           { field: 'unitcost', title: 'Unit Cost', 80, align: 'right', sortable: true },
                           { field: 'attr1', title: 'Attribute', 100 },
                           { field: 'status', title: 'Status', 60 }
                           ]]

    单行标题用Js实现:

    $('#tt').datagrid({
    columns: [[
    { field: 'itemid', title: 'Item ID', 80 },
    { field: 'productid', title: 'Product ID', 80 },
    { field: 'listprice', title: 'List Price', 80, align: 'right' },
    { field: 'unitcost', title: 'Unit Cost', 80, align: 'right' },
    { field: 'attr1', title: 'Attribute', 100 },
    { field: 'status', title: 'Status', 60 }
    ]]
    });

    实现一个table的数据加载例子:

    静态:   

     var data_ = [{

                "dataindex0": "1",

                "dataindex1": "Y08",

                "dataindex2": "Y00000000158",

                "dataindex3": "注",

                "dataindex4": "Z",

                "dataindex5": "注",

                "dataindex6": "250",

                "dataindex7": "东北厂",

                "dataindex8": "国",

                "dataindex9": "123123",

                "dataindex10": null,

                "dataindex11": null,

                "dataindex12": null,

                "dataindex13": null

            },

           {

                "dataindex0": "1",

                "dataindex1": "Y08",

                "dataindex2": "Y00000000158",

                "dataindex3": "注",

                "dataindex4": "Z",

                "dataindex5": "注",

                "dataindex6": "250",

                "dataindex7": "东北厂",

                "dataindex8": "国",

                "dataindex9": "123123",

                "dataindex10": null,

                "dataindex11": null,

                "dataindex12": null,

                "dataindex13": null

            }];

       方法一:

     $('#dg').datagrid({

            fit: true,

            checkOnSelect: true,

            selectOnCheck: true,

            singleSelect: true,

            fitColumns: true,

            data:data_,

            //pageSize:100,

            //pagination:true,

            columns: [[

                { field: 'dataindex0', title: 'dataindex0', 80 },

                { field: 'dataindex1', title: 'dataindex1', 80 },

                { field: 'dataindex2', title: 'dataindex2', 80 },

                { field: 'dataindex3', title: 'dataindex3', 80 },

                { field: 'dataindex4', title: 'dataindex4', 80 },

                { field: 'dataindex5', title: 'dataindex5', 80 },

                { field: 'dataindex6', title: 'dataindex6', 80 },

                { field: 'dataindex7', title: 'dataindex7', 80 },

                { field: 'dataindex8', title: 'dataindex8', 80 },

                { field: 'dataindex9', title: 'dataindex9', 80 }

            ]]

        });

    方法二:

     $('#dg').datagrid({

            fit: true,

            checkOnSelect: true,

            selectOnCheck: true,

            singleSelect: true,

            fitColumns: true,

            //pageSize:100,

            //pagination:true,

            columns: [[

                { field: 'dataindex1', title: 'dataindex1', 80 },

                { field: 'dataindex2', title: 'dataindex2', 80 },

                { field: 'dataindex3', title: 'dataindex3', 80 },

                { field: 'dataindex4', title: 'dataindex4', 80 },

                { field: 'dataindex5', title: 'dataindex5', 80 },

                { field: 'dataindex6', title: 'dataindex6', 80 },

                { field: 'dataindex7', title: 'dataindex7', 80 },

                { field: 'dataindex8', title: 'dataindex8', 80 },

                { field: 'dataindex9', title: 'dataindex9', 80 },

                { field: 'dataindex10', title: 'dataindex10', 80 }

            ]]

        });

  • 相关阅读:
    Hia~hia~
    细节与销售
    敛财术
    酒井法子
    买了新手机NOKIA E71
    观《拉贝日记》
    居然不配套
    2009上海最新“四金”及个人所得税计算(器)
    有好听点的新歌么?
    我家乌龟终于下蛋了!
  • 原文地址:https://www.cnblogs.com/huangf714/p/5832297.html
Copyright © 2011-2022 走看看