码迷,mamicode.com
首页 > 其他好文 > 详细

DataGrid 添加toolbar

时间:2015-01-23 01:00:42      阅读:293      评论:0      收藏:0      [点我收藏+]

标签:

<1>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>DataGrid with Toolbar - jQuery EasyUI Demo</title>
    <link href="easyui.css" rel="stylesheet" type="text/css" />
    <link href="icon.css" rel="stylesheet" type="text/css" />
    <link href="demo.css" rel="stylesheet" type="text/css" />
    <script src="jquery-1.11.2.js" type="text/javascript"></script>
    <script src="jquery.easyui.min.js" type="text/javascript"></script>
</head>


<body>
	<h2>DataGrid with Toolbar</h2>
	<div class="demo-info">
		<div class="demo-tip icon-tip"></div>
		<div>Put buttons on top toolbar of DataGrid.</div>
	</div>
	<div style="margin:10px 0;"></div>
	<table class="easyui-datagrid" title="DataGrid with Toolbar" style="width:700px;height:250px" data-options="rownumbers:true,singleSelect:true,url:'../datagrid/datagrid_data1.json',toolbar:toolbar">
		<thead>
			<tr>
				<th data-options="field:'itemid',width:80,align:'left'">编号</th>
				<th data-options="field:'productid',width:100,align:'left'">姓名</th>
				<th data-options="field:'listprice',width:80,align:'left'">年龄</th>
				<th data-options="field:'unitcost',width:80,align:'left'">籍贯</th>
				<th data-options="field:'attr1',width:80,align:'left'">性别</th>
				<th data-options="field:'status',width:250,align:'left'">地址</th>
			</tr>
		</thead>
	</table>
</body>
</html>
</body>
<script type="text/javascript">
    var toolbar = [{
        text: '添加',
        iconCls: 'icon-add',
        handler: function () { alert('添加') }
    }, '-', //这个'-'的效果是将各个字段用 |隔开
    {
       text: '删除',
	   iconCls: 'icon-remove',
	   handler: function () { alert('删除') }
    }, '-',
    {
        text: '剪切',
        iconCls: 'icon-cut',
        handler: function () { alert('剪切') }
    }, '-',
    {
        text: '编辑',
        iconCls: 'icon-edit',
        handler: function () { alert('编辑') }
    }, '-', 
    {
        text: '保存',
        iconCls: 'icon-save',
        handler: function () { alert('保存') }
    }];
	</script>

</html>



DataGrid 添加toolbar

标签:

原文地址:http://blog.csdn.net/fanbin168/article/details/43032317

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!