国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

Expandable "Detail" Table Rows

2019-11-21 01:56:35
字體:
來源:轉載
供稿:網友

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)

IDNameTotal
123Bill Gates100
 2007-01-02A short description15
 2007-02-03Another description45
 2007-03-04More Stuff40
456Bill Brasky50
 2007-01-02A short description10
 2007-02-03Another description20
 2007-03-04More Stuff20
789Phil Upspace75
 2007-01-02A short description33
 2007-02-03Another description22
 2007-03-04More Stuff20
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 南靖县| 望谟县| 宁安市| 瑞丽市| 常州市| 原平市| 五华县| 屯门区| 泰宁县| 德保县| 互助| 渑池县| 巫溪县| 成都市| 桐城市| 德清县| 东台市| 朔州市| 泸水县| 石台县| 鄂温| 五指山市| 罗山县| 剑阁县| 西畴县| 台中市| 清河县| 萍乡市| 遂昌县| 察雅县| 丰都县| 大埔区| 南通市| 灯塔市| 兴义市| 高雄市| 石柱| 长丰县| 运城市| 綦江县| 桂林市|