ext的排序,根据点击列表列, 对所有数据进行排序, 而不是仅仅对当前页排序

1 store中设置   remoteSort:true,       //用服务端的排序规则
2 String sort = request.getParameter("sort");//排序字段      因为ext会根据点击列自动传递sort参数,
3 处理 sort数据  //获取排序字段和排序方式
JSONArray jsonArray = null;
jsonArray = new JSONArray(sort);
String property = (String) jsonArray.getJSONObject(0).get("property");//排序字段
String direction = (String) jsonArray.getJSONObject(0).get("direction");//排序方式 ASC/DESC

4 处理property
//需要的排序字段的判断
if("createDate".equals(property)) {
property = "create_date";
}else if("updateDate".equals(property)) {
property = "update_date";
}else {
property=null;
}


4 sql的xml中 ,
<if test="direction!= null and '' !=direction and property!= null and '' !=property">
order by c.${property} ${direction} 
</if>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值