手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >Expandable "Detail" Table Rows
Expandable "Detail" Table Rows
摘要:AcommonUIistohaveatableofdatarows,whichwhenclickedonexpandtoshowadetai...

AcommonUIistohaveatableofdatarows,whichwhenclickedonexpandtoshowadetailedbreakdownof"child"rowsbelowthe"parent"row.

Theonlyrequirementsare:

Putaclassof"parent"oneachparentrow(tr)

Giveeachparentrow(tr)anid

Giveeachchildrowaclassof"child-ID"whereIDistheidoftheparenttrthatitbelongsto

ExampleCode

$(function(){

$('tr.parent')

.css("cursor","pointer")

.attr("title","Clicktoexpand/collapse")

.click(function(){

$(this).siblings('.child-'+this.id).toggle();

});

$('tr[@class^=child-]').hide().children('td');

});ExampleTable(clickarow)

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

【Expandable "Detail" Table Rows】相关文章:

Nodejs中session的简单使用及通过session实现身份验证的方法

javascript制作的滑动图片菜单

js实现两点之间画线的方法

安装使用Mongoose配合Node.js操作MongoDB的基础教程

js跨域请求的5中解决方式

JavaScript中用于生成随机数的Math.random()方法

Jquery跨浏览器文本复制插件Zero Clipboard的使用方法

js实现文本框选中的方法

超强图片数量上传无限制

javascript带回调函数的异步脚本载入方法实例分析

精品推荐
分类导航