JQuery DataTables 列自己定义数据类型排序
使用JQ DataTables 的时候。希望某列数据能够进行自己定义排序。操作例如以下:(以中文排序和百分比排序为例)
1:定义排序类型:
//百分率排序
jQuery.fn.dataTableExt.oSort['number-fate-asc'] = function(s1,s2) {
s1 = s1.replace('%','');
s2 = s2.replace('%','');
return s1-s2;
}; jQuery.fn.dataTableExt.oSort['number-fate-desc'] = function(s1,s2) {
s1 = s1.replace('%','');
s2 = s2.replace('%','');
return s2-s1;
};
//中文排序
jQuery.fn.dataTableExt.oSort['chinese-string-asc'] = function(s1,s2) {
return s1.localeCompare(s2);
};
jQuery.fn.dataTableExt.oSort['chinese-string-desc'] = function(s1,s2) {
return s2.localeCompare(s1);
};
2:指定排序的列:
$('#flexme1').dataTable({
"aoColumns": [
null,
{ "sType": "chinese-string" },//中文排序列
null,
{ "sType": "number-fate" },//百分率排序
null,
null
]
});
JQuery DataTables 列自己定义数据类型排序的更多相关文章
- jQuery dataTables 列不对齐的原因
如果把 jQuery dataTables 用在初始化时为隐藏的区域中,会发现表头和内容的列是不对齐的. 解决方案: 如果是折叠的,可以加上: $('#myCollapsible').on('show ...
- jquery.dataTables列中内容居中问题?求解?
.table > tbody > tr > td { vertical-align: middle; }
- jquery.dataTables动态列--转
转自 https://www.cnblogs.com/lyeo/p/4765514.html jquery.dataTables 版本1.10.7 直接上代码: 0.table <table ...
- jquery.dataTables动态列
jquery.dataTables 版本1.10.7 直接上代码: 0.table <table id="popReportTable"> <thead> ...
- jquery datatables api (转)
学习可参考:http://www.guoxk.com/node/jquery-datatables http://yuemeiqing2008-163-com.iteye.com/blog/20069 ...
- 最全的jquery datatables api 使用详解
学习可参考:http://www.guoxk.com/node/jquery-datatables http://yuemeiqing2008-163-com.iteye.com/blog/20069 ...
- jquery datatables api
原文地址 学习可参考:http://www.guoxk.com/node/jquery-datatables http://yuemeiqing2008-163-com.iteye.com/blog/ ...
- JQuery DataTables学习
1.Datatables简单介绍 DataTables是一个jQuery的表格插件.这是一个高度灵活的工具,根据的基础逐步增强,这将添加先进的互动控制.支持不论什么HTML表格. 主要特点: 自己主动 ...
- jquery DataTables表格插件的使用(网页数据表格化及分页显示)
DataTables - 非常强大的 jQuery 表格插件,可变宽页码浏览,现场过滤. 多列排序,自动探测数据类型,智能列宽,可从几乎任何数据源获取数据. 那么在Bootstrap下如何使用Data ...
随机推荐
- CF 420B Online Meeting 模拟题
只是贴代码,这种模拟题一定要好好纪念下 TAT #include <cstdio> #include <cstring> #include <algorithm> ...
- cocos2d-x 学习资源整理(持续更新...)
生活像一把无情刻刀.改变了我们模样.以前我以为会亘古不变的东西,突然在一瞬间失去了信念... 假设你改变不了生活中患得患失的心情.那就试着让自己变得强大一点.由于能做到不以物喜不以己悲都是建立在强大的 ...
- CentOS 配置防火墙操作实例(启、停、开、闭port)
CentOS 配置防火墙操作实例(启.停.开.闭port): 注:防火墙的基本操作命令: 查询防火墙状态: [root@localhost ~]# service iptables status& ...
- 酱油记:GDKOI2018
GDKOI2018,走出机房的第六场考试 DAY0 这一次GDKOI,第一次在广州二中考,第一次住在柏高酒店(住宿条件杠杠的!),晚上就到对面的万达广场吃了顿烤肉,到老师那里开会,然后就回酒店睡了 D ...
- POJ 1610 Count the Colors
Count the Colors Time Limit: 2 Seconds Memory Limit: 65536 KB Painting some colored segments on ...
- Beautiful Number
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2829 Beautiful Number Time Limit: 2 Sec ...
- DEDECMS教程:列表页缩略图随机调用
如果用过DEDECMS的朋友应该都知道,有些模板列表页面需要用到缩略图,调用内容中的缩略图可以使用系统自带的脚本调用第一张图片.但是,并不是我们所有的内容里都有图片,有时候第一张图片也不一定是适合尺寸 ...
- shell中IF的用法介绍
一.语法结构 if [ condition ] then statements [elif condition then statements. ..] [else ...
- Mysql学习总结(3)——MySql语句大全:创建、授权、查询、修改等
一.用户创建.权限.删除 1.连接MySql操作 连接:mysql -h 主机地址 -u 用户名 -p 用户密码 (注:u与root可以不用加空格,其它也一样) 断开:exit (回车) 打开cmd, ...
- CodeForcesGym 100502D Dice Game
Dice Game Time Limit: 1000ms Memory Limit: 524288KB This problem will be judged on CodeForcesGym. Or ...