jquery 中的table sort控制
2013-11-05 11:02
253 查看
前段table Header
js代码
<thead id ="tablehe" style="display:none"> <tr id="tablehead"> <th class="tabhead" width="15%"><div sortname="companyName" class="">Company</div></th> <th class="tabhead tabhead_on" width="15%"><div sortname="opportunityName" class="arrowdiv_up">Title</div></th> <th class="tabhead" width="16%"><div sortname="pursuitLeaderName" class="">Pursuit Leader</div></th> <th class="tabhead" width="10%"><div sortname="service" class="">Service</div></th> <th class="tabhead" width="11%"><div sortname="probability" class="">Probability</div></th> <th class="tabhead" width="12%"><div sortname="salesStage" class="">Sales Stage</div></th> <th class="tabhead" width="11%"><div sortname="closeDate" class="">Close date</div></th> <th class="tabhead" colspan="2" width="20%"><div sortname="tcv" class="">TCV</div></th> </tr> </thead>
js代码
function registerSortable(){ $("#tablehead").children().each(function(i,e){ $(this).click(function(d){ $(this).siblings().children("div").removeClass("arrowdiv_up"); $(this).siblings().children("div").removeClass("arrowdiv_down"); $(this).siblings("th").removeClass("tabhead_on"); $(this).addClass("tabhead_on");
var sortASC; var div = $(this).find("div:eq(0)"); var sortClumn = div.attr("sortname"); if(!div.hasClass("arrowdiv_down") && !div.hasClass("arrowdiv_up")){ div.addClass("arrowdiv_up"); sortAsc = true; }else{ if(div.hasClass("arrowdiv_down")){ div.removeClass("arrowdiv_down"); div.addClass("arrowdiv_up"); sortAsc = true; }else if(div.hasClass("arrowdiv_up")){ div.removeClass("arrowdiv_up"); div.addClass("arrowdiv_down"); sortAsc = false; } } }
相关文章推荐
- jQuery控制Table
- jquery 控制table tr 上下移动
- js实现table排序(jQuery下的jquery.sortElements)
- jquery.tableSort.js表格排序插件使用方法详解
- jquery 控制 table的margin-top属性
- Jquery-控制table的奇偶数色列
- Jquery.Sorttable 桌面拖拽自定义
- jquery控制table中的input样式,巧妙利用标签元素,隐藏input边框
- Jquery-1.3.2在IE8中用toggle控制table 的 tr td显示和隐藏问题
- 排序插件jquery.tableSort.js
- 采用Jquery,在table上实现对行的单击、双击、返回选中行数据的功能,可作为GridView控制客户端的扩展
- table中嵌套table,如何用jquery来控制奇偶行颜色
- jquery dragsort table实现拖拽排序
- jquery each控制checkbox有关内容(table tr)的显示或隐藏(jquery 按条件隐藏显示已输出内容)
- 自己动手丰衣足食之表格排序插件jquery.tableSort.js
- Jquery.Sorttable 桌面拖拽自定义
- jQuery控制table进行添加和删除
- jquery sortTable拖拽排序
- jquery控制table过滤,重新隔行变色
- js实现table排序(jQuery下的jquery.sortElements)