easyui datagrid 如何实现单击列自动排序

等不到的彼岸花 2013-04-24 09:39:28

<div id="CustListGrid" style=" width:1170px;margin-top:10px" pagesize="10" pagelist="[10, 15]" pagination="true"></div>


$('#CustListGrid').datagrid({
url: '',
singleSelect: true,
remoteSort:true,
columns: [[
{ field: 'CustomerName', title: '客户名称', width: 100, align: 'center',sortable:true},
{ field: 'UserName', title: '业务员', width: 100, align: 'center',sortable:true },
{ field: 'EmployeesNumber', title: '公司人数', width: 100, align: 'center',sortable:true },
{ field: 'CustomerProperty', title: '公司性质', width: 100, align: 'center',sortable:true },
{ field: 'CustomerTrade', title: '行业', width: 100, align: 'center',sortable:true },
{ field: 'CustomerCity', title: '城市', width: 100, align: 'center',sortable:true }
{ field: 'CreaterTime', title: '录入时间', width: 150, align: 'center',sortable:true }
]]
});


我已经实现了数据的分页显示,默认的是修改时间排序,但是现在要实现单击列自动排序,找了好多资料都不行,好多都要重新写一个自动排序的方法,看了也没看懂,都不会用,哪位大大帮个忙啊,最好是有源码...
...全文
825 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
clark_kidd 2013-04-24
  • 打赏
  • 举报
回复
remoteSort:true 你这里设置了服务器排序 所以,点击列以后,会触发一个 ajax 的服务器回传,再由服务器排序,重新输出请求页的数据。 要在服务器request["sort"] request["order"] 这两个值,进行排序处理后重新组织json字符串

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧