使用datagrid实现页面间的排序查询
2018-02-05 20:26
225 查看
最近使用easy-ui的表格时,发现有很多强大的东西,暂列一个实现排序的demo案例:
div中给table一个class或者是id都可以.
<div class="row" id="datagrid-panel">
<div class="col-sm-12">
<div class="box border darkblue">
<div class="box-title">
<h4>
<i class="fa fa-th" style="color:#fff;"></i>
列表信息
</h4>
</div>
<div class="box-body">
<table class="easyui-datagrid"></table>
</div>
</div>
</div>
</div>
页面引入easy-ui datagrid相应的js文件.不一一列举了...
在页面加载执行:
$(".easyui-datagrid").datagrid({
url: "${ctxPath}/salesreport/list.html",
queryParams: {
beginDate: beginDate,
endDate:endDate
},
singleSelect:true,
remoteSort:false,
fitColumns:true,
multiSort:true,
nowrap: true,//false - 单元格数据多的时候进行折行 true - 不管数据有多少,都在一行显示
border: false,
loadMsg:"正在努力加载数据中...",
columns: [
[
{field: "goodsId", title: "商品id",hidden:"true", width: 300}
, {field: "goodsName", title: "商品名称", width: 300}
, {field: "barcode", title: "条形码", width: 200}
, {field: "goodsPrice", title: "销售单价", width: 200,sortable:true,
sorter:function(a,b){
return (a > b ? 1 : -1 );
}}
, {field: "amount", title: "销售数量", width: 200,sortable:true,
sorter:function(a,b){
return (a > b ? 1 : -1 );
}}
, {field: "costAll", title: "成本", width: 200,sortable:true,
sorter:function(a,b){
return (a > b ? 1 : -1 );
}}
, {field: "turnover", title: "营业额", width: 200,sortable:true,
sorter:function(a,b){
return (a > b ? 1 : -1 );
}}
, {field: "grossProfit", title: "毛利", width: 200,sortable:true,
sorter:function(a,b){
return (a > b ? 1 : -1 );
}}
, {field: "grossProfitRate", title: "毛利率", width: 200,sortable:true,
sorter:function(a,b){
return (a > b ? 1 : -1 );
}}
]
]
});根据自己需要排序的进行给field字段设置sortable属性.注意禁用后台排序,给属性
multiSort:true,这是属性,英文好点儿的话,都能理解的.
暂时记录一下,谢谢.
div中给table一个class或者是id都可以.
<div class="row" id="datagrid-panel">
<div class="col-sm-12">
<div class="box border darkblue">
<div class="box-title">
<h4>
<i class="fa fa-th" style="color:#fff;"></i>
列表信息
</h4>
</div>
<div class="box-body">
<table class="easyui-datagrid"></table>
</div>
</div>
</div>
</div>
页面引入easy-ui datagrid相应的js文件.不一一列举了...
在页面加载执行:
$(".easyui-datagrid").datagrid({
url: "${ctxPath}/salesreport/list.html",
queryParams: {
beginDate: beginDate,
endDate:endDate
},
singleSelect:true,
remoteSort:false,
fitColumns:true,
multiSort:true,
nowrap: true,//false - 单元格数据多的时候进行折行 true - 不管数据有多少,都在一行显示
border: false,
loadMsg:"正在努力加载数据中...",
columns: [
[
{field: "goodsId", title: "商品id",hidden:"true", width: 300}
, {field: "goodsName", title: "商品名称", width: 300}
, {field: "barcode", title: "条形码", width: 200}
, {field: "goodsPrice", title: "销售单价", width: 200,sortable:true,
sorter:function(a,b){
return (a > b ? 1 : -1 );
}}
, {field: "amount", title: "销售数量", width: 200,sortable:true,
sorter:function(a,b){
return (a > b ? 1 : -1 );
}}
, {field: "costAll", title: "成本", width: 200,sortable:true,
sorter:function(a,b){
return (a > b ? 1 : -1 );
}}
, {field: "turnover", title: "营业额", width: 200,sortable:true,
sorter:function(a,b){
return (a > b ? 1 : -1 );
}}
, {field: "grossProfit", title: "毛利", width: 200,sortable:true,
sorter:function(a,b){
return (a > b ? 1 : -1 );
}}
, {field: "grossProfitRate", title: "毛利率", width: 200,sortable:true,
sorter:function(a,b){
return (a > b ? 1 : -1 );
}}
]
]
});根据自己需要排序的进行给field字段设置sortable属性.注意禁用后台排序,给属性
remoteSort:false,多个排序时,使用
multiSort:true,这是属性,英文好点儿的话,都能理解的.
暂时记录一下,谢谢.
相关文章推荐
- jquery easyui datagrid使用,分页、排序、查询
- 使用bootstraptable插件实现表格记录的查询、分页、排序操作
- Asp.Net使用Easy UI DataGrid 实现行过滤[行模糊查询数据]
- jquery easyui datagrid使用,分页、排序、查询
- 基于Metronic的Bootstrap开发框架经验总结(16)-- 使用插件bootstrap-table实现表格记录的查询、分页、排序等处理
- 基于BootStrap的Metronic框架实现页面链接收藏夹功能按钮移动收藏记录(使用Sortable进行拖动排序)
- 实现功能要求统计图书的总价,编写方法查询出在50元以上的所有图书,使用排序接口图书按照价格排序(升序排序)
- 使用json实现查询条件传回Action进行hql语句拼接查询实现在结果中查询功能在datagrid中显示查询结果
- 使用MVC,实现多条件查询,排序与分页 的 存储过程
- 使用该JavaBean可以将数据在JSP页面中以表格的形式显示出来,并具有动态排序、动态生成查询、自动分页功能
- 使用插件bootstrap-table实现表格记录的查询、分页、排序等处理
- 使用插件bootstrap-table实现表格记录的查询、分页、排序等处理
- ASP.NET使用EasyUI-DataGrid + ashx + JQuery Ajax:实现数据的增删查改,查询和分页!
- 使用ADF-BC 实现查询功能之三:如何在页面装载时自动执行查询?
- 如何在JSP页面中不使用任何插件实现分页查询
- 在ASP.NET MVC中使用Boostrap实现产品的展示、查询、排序、分页
- 基于BootStrap的Metronic框架实现页面链接收藏夹功能按钮移动收藏记录(使用Sortable进行拖动排序)
- 使用jquery-sortable交互工具和acts_as_list rubygem实现页面拖动排序
- SQL Server2005使用ROW_NUMBER() OVER实现按分组查询Count()数量排序并分页
- 【转】 jquery easyui datagrid使用,分页、排序、查询