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

首頁 > 開發(fā) > JS > 正文

Expandable "Detail" Table Rows

2024-09-06 12:41:36
字體:
供稿:網(wǎng)友

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
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 绵阳市| 全椒县| 莱州市| 拉萨市| 吉安县| 灌云县| 黎川县| 濮阳市| 麻栗坡县| 略阳县| 云阳县| 安陆市| 恩施市| 延吉市| 怀仁县| 洪江市| 天长市| 成都市| 阿拉善右旗| 咸阳市| 洪泽县| 长岛县| 莱芜市| 南岸区| 古蔺县| 新密市| 读书| 双城市| 沽源县| 晋中市| 英吉沙县| 鸡西市| 武强县| 肃宁县| 巨野县| 宁安市| 刚察县| 曲周县| 黑山县| 郧西县| 三门县|