作家
登录

Expandable "Detail" Table Rows

作者: 来源:www.28hudong.com 2013-03-30 03:18:09 阅读 我要评论

A common UI is to have a table of data rows, which when clicked on expand to show a detailed breakdown of "child" rows below the "parent" row. The only requirements are: Put a class of "parent" on each parent row (tr) Give each parent row (tr) an id Give each child row a class of "child-ID" where ID is the id of the parent tr that it belongs to Example Code $(function() { $('tr.parent') .css("cursor","pointer") .attr("title","Click to expand/collapse") .click(function(){ $(this).siblings('.child-'+this.id).toggle(); }); $('tr[@class^=child-]').hide().children('td'); });Example Table (click a row) ID Name Total 123 Bill Gates 100 2007-01-02 A short description 15 2007-02-03 Another description 45 2007-03-04 More Stuff 40 456 Bill Brasky 50 2007-01-02 A short description 10 2007-02-03 Another description 20 2007-03-04 More Stuff 20 789 Phil Upspace 75 2007-01-02 A short description 33 2007-02-03 Another description 22 2007-03-04 More Stuff 20

  推荐阅读

  (兼容ff/ie)td点击背景变色特效

.class1{ background:#efefef; text-align:center; width:80px; } .class2{ background: #ffcc00; text-align:center; width: 80px; >>>详细阅读


本文标题:Expandable "Detail" Table Rows

地址:http://www.17bianji.com/kaifa2/JS/30110.html

关键词: 探索发现

乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

网友点评
自媒体专栏

评论

热度

精彩导读
栏目ID=71的表不存在(操作类型=0)