EasyUI DataGrid 添加排序
2016-09-27 10:25
309 查看
这个事例演示了如何在点击列头的时候排序
DataGrid中全部的列可以通过点击列头被排序。你可以定义可以被排序的列。默认的,列不能被排序除非你设置sortable属性为TRUE,下面是例子:
标记
我们定义一些可排序的列,包括itemid,productid,listprice,unitcost等。attr1列和status列不能被排序。我们设置默认排序列:itemid,按asc(升序)排序。
当排序时, DataGrid发送两个参数到服务器:
· sort: 排序列字段名
· order: 排序次序: 'asc' 或 'desc', 默认为'asc'.
我们使用etmvc framework 写后台服务器代码,首先定义数据模型
DataGrid中全部的列可以通过点击列头被排序。你可以定义可以被排序的列。默认的,列不能被排序除非你设置sortable属性为TRUE,下面是例子:
标记
<table id="tt"></table> jQuery $('#tt').datagrid({ title:'Sortable Column', width:550, height:250, url:'/demo4/data/getItems', columns:[[ {field:'itemid',title:'Item ID',width:80,sortable:true}, {field:'productid',title:'Product ID',width:80,sortable:true}, {field:'listprice',title:'List Price',width:80,align:'right',sortable:true}, {field:'unitcost',title:'Unit Cost',width:80,align:'right',sortable:true}, {field:'attr1',title:'Attribute',width:100}, {field:'status',title:'Status',width:60} ]], pagination:true, sortName:'itemid', sortOrder:'asc' });
我们定义一些可排序的列,包括itemid,productid,listprice,unitcost等。attr1列和status列不能被排序。我们设置默认排序列:itemid,按asc(升序)排序。
当排序时, DataGrid发送两个参数到服务器:
· sort: 排序列字段名
· order: 排序次序: 'asc' 或 'desc', 默认为'asc'.
我们使用etmvc framework 写后台服务器代码,首先定义数据模型
相关文章推荐
- easyUI 添加排序到datagrid
- easyUI 添加排序到datagrid
- easyUI 添加排序到datagrid
- easyUI 添加排序到datagrid
- easyui datagrid 添加 鼠标事件
- easyui datagrid 动态添加、移除editor
- easyUI datagrid ajax实时刷新 动态添加列名
- easyUI datagrid每行数据添加操作按钮的方法(实现方式二)
- 【第十篇】easyui-datagrid排序 (转)
- 基于asp.net + easyui框架,一步步学习easyui-datagrid——实现添加、编辑、删除(三)
- EasyUI DataGrid添加超链接
- 扩展easyui.datagrid,添加数据loading遮罩效果代码
- jQuery扩展easyui.datagrid,添加数据loading遮罩效果代码
- EasyUI Datagrid 分页和排序
- easyUI datagrid自定义添加列 (点击事件)
- 02.手把手教你 .Net EasyUI DataGrid(数据表格排序)
- easyui datagrid添加行时让高度自适应
- easyui中 datagrid排序的问题
- JS-easyui 扩展easyui.datagrid,添加数据loading遮罩效果代码
- easyui datagrid 添加超链接 并传值