手机
当前位置:查字典教程网 >编程开发 >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】相关文章:

JavaScript实现单击下拉框选择直接跳转页面的方法

JavaScript判断数组是否包含指定元素的方法

浅谈javascript中的闭包

javascript字符串与数组转换汇总

网页常用Javascript

超强图片数量上传无限制

JS动态增删表格行的方法

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

CheckBox 如何实现全选?

html代码调试脚本

精品推荐
分类导航