国产探花免费观看_亚洲丰满少妇自慰呻吟_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
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 登封市| 刚察县| 淳化县| 茂名市| 南投县| 南江县| 内黄县| 浮山县| 嘉禾县| 西乌珠穆沁旗| 焉耆| 淮安市| 区。| 四平市| 嘉善县| 余姚市| 苏州市| 永新县| 浑源县| 贵州省| 阳朔县| 平和县| 手游| 淮安市| 那曲县| 明光市| 高密市| 汕头市| 正镶白旗| 仁怀市| 随州市| 望谟县| 耒阳市| 万年县| 旅游| 靖边县| 永嘉县| 南康市| 陆川县| 赫章县| 罗田县|