jqGrid表头排序功能
来源:互联网 发布:2017最热门网络手游 编辑:程序博客网 时间:2024/05/21 21:46
1.单级排序
描述:顾名思义,即按照单个表头进行排序,但是允许多个表头都是排序字段,只是传值时只传当前点击的表头
1. 后端配置
需要在后台接收sidx和sord,sidx是固定参数,其值为所点击的列名,sord也为固定参数,其为排序方式,升序还是降序
可以将这两个字段单独在controller方法中去接受,也可以写到实体类中作为字段去接收,本例中将这两个参数写到实体类中
sql中order by时需要用动态参数去取值
controller代码如下:
@RequestMapping(value = "/selectGuideJudgeStatisticsForPage.json", method = RequestMethod.POST)public @ResponseBody IPageModule selectGuideJudgeStatisticsForPage(HttpServletRequest request, HttpServletResponse response, GuideInfo guideInfo,String sord,String sidx) { IPageModule pageModule = null; try { System.out.println(sord); System.out.println(sidx); pageModule= guideJudgeService.selectGuideJudgeStatisticsForPage(guideInfo); } catch(Exception e) { e.printStackTrace(); } return pageModule; }
map-*.xml代码部分如下:
ORDER BY <choose> <when test="sidx != null and sidx != ''"> ${sidx} ${sord} </when> <otherwise> T.NAME </otherwise> </choose>
需要注意的是此处取值使用$,不能使用#,只需要判断sidx是否有值即可,因为sord一直都有值,如果不需要默认排序,也可以这样写:
<if test="sidx != null and sidx != ''"> ORDER BY ${sidx} ${sord}</if>
2. 前端配置
multiSort属性设置为false:multiSort: false,也可以不写。
colModel属性对应列设置排序参数,如下:
colModel: [ {name: 'guideId', index: 'guideId', width: 0, sortable:false, align:'left', hidden:true, key:true}, {name: 'name', index: 'name', width: 20, sortable:false,align:'left'}, {name: 'phone', index: 'phone', width: 25, sortable:false,align:'center'}, {name: 'avgJudgeScore', index: 'avgJudgeScore', width: 25, dataType: "float", sortable: true,align:'center'}, {name: 'judgeCounts', index: 'judgeCounts', width: 25, dataType: "int", sortable: true,align:'center'}],
这两个属性:dataType: “int”, sortable: true
2.多级排序
描述:即可以按照多个表头进行联合排序
1. 后端配置
- 与单级排序的写法上没有区别
2. 前端配置
- 与单级排序的区别:添加multiSort或者更改multiSort属性为true即可
0 0
- jqGrid表头排序功能
- jqGrid表头锁列及排序功能细节
- jqGrid 排序功能
- jqGrid多次表头排序会累加排序条件问题
- web 网页 表头排序功能
- html table表头排序功能
- Repeater点击表头,排序功能
- jqgrid隐藏表头
- jqgrid固定表头
- jqgrid实现多级表头
- jqGrid合并表头
- jqGrid 两层表头
- Repeater 实现复合表头、排序功能。
- bootstrap点击表头实现排序功能
- Jqgrid入门-Jqgrid设置二级表头(六)
- jqGrid设置三级表头和表头合并
- jqGrid实现表头自动换行
- JQGrid表头自动换行的办法
- 前端自学之路——一个不爱看书的女孩
- Mac下利用apache进行多站点配置
- txt文本文件编码格式-图片文件类型检测-音视频文件信息
- CodeForces 733 B.Parade(水~)
- splay
- jqGrid表头排序功能
- XML-绘图
- Hadoop HA 模式下运行spark 程序
- ListControl
- 字符串转为Map类型:split()方法的应用
- 根据包名获取应用图标和名称
- zigbee的发展及应用
- CodeForces 316D3 PE Lesson
- shape的圆角