推荐一个jquery排序分页插件

DATATABLES

致力于使用简单的页面客户端排序,分页jquery插件。推荐这个是因为自己用的时候相当容易。最简单使用如下:
1. 把你的table加个ID
2. 确保你的table有thead和tbody分别放th和td
3. 添加javascript lab

=javascript_include_tag "http://www.datatables.net/release-datatables/media/js/jquery.dataTables.js"
=stylesheet_link_tag "http://www.datatables.net/release-datatables/media/css/demo_table.css"
=stylesheet_link_tag "http://www.datatables.net/release-datatables/media/css/demo_page.css"

4. 添加jquery处理

$(document).ready(function() {
$('#example').dataTable();
} );


5. 如果,你的字段里有数字的话,因为有数字的时候,默认js是安装string排的
需要修改如下:
注明,两种写法只用一个就可以,都是表明对应的字段类型的。
详细参考:
[url]http://datatables.net/usage/columns#sType[/url]

/* Using aoColumnDefs */
$(document).ready(function() {
$('#example').dataTable( {
"aoColumnDefs": [
{ "sType": "html", "aTargets": [ 0 ] }
]
} );
} );

/* Using aoColumns */
$(document).ready(function() {
$('#example').dataTable( {
"aoColumns": [
{ "sType": "html" },
null,
null,
null,
null
]
} );
} );

[url=http://datatables.net/release-datatables/examples/basic_init/zero_config.html]效果演示demo[/url]


功能列表:
[quote]
Variable length pagination
On-the-fly filtering
Sorting with data type detection
Smart handling of column widths
Themeable by CSS
Hidden columns
Extremely customisable and flexible
Fully internationalisable
Dynamic creation of tables
Multi-column sorting
Custom DOM positioning
Single column filtering
Alternative pagination types
Non-destructive DOM interaction
Ajax auto loading of data
Type detection for dynamic data (and plugin support)
State saving
API plug-in mechanism
It's free!
[/quote]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值