EasyUI DataGrid表格控件

代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>DataGrid</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script src="../jquery-1.4.2.min.js" type="text/javascript"></script>
    <script src="../jquery.easyui.min.js" type="text/javascript"></script>

    <link href="../themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../themes/icon.css" rel="stylesheet" type="text/css" />
    
    <script type="text/javascript">
        $(function() {
            $('#test').datagrid({
                title: 'jQuery EasyUI---DataGrid',
                iconCls: 'icon-save',
                width: 500,
                height: 350,
                nowrap: false,
                striped: true,
                url: '../Data/datagrid_data.json',
                sortName: 'ID',
                sortOrder: 'desc',
                idField: 'ID',
                frozenColumns: [[
                    { field: 'ck', checkbox: true },
                    { title: 'ID', field: 'ID', width: 80, sortable: true }
                ]],
                columns: [[
                    { title: '基本信息', colspan: 2 },
                    { field: 'opt', title: '操作', width: 100, align: 'center', rowspan: 2,
                        formatter: function(value, rec) {
                            return '<span style="color:red">编辑 删除</span>';
                        }
                    }
                ], [
                    { field: 'name', title: 'Name', width: 120 },
                    { field: 'addr', title: 'Address', width: 120, rowspan: 2, sortable: true }
                ]],
                pagination: true,
                rownumbers: true,
                singleSelect: false,
                toolbar: [{
                    text: '添加',
                    iconCls: 'icon-add',
                    handler: function() {
                    alert('添加数据')
                    }
                }, '-', {
                    text: '保存',
                    iconCls: 'icon-save',
                    handler: function() {
                    alert('保存数据')
                    }
                }]
                });
            });
            
    </script>
</head>
<body>
    <table id="test"></table>
</body>
</html>

效果



  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 6
    评论
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值