Expandable "Detail" Table Rows

angels星星

angels星星

2016-02-19 09:04

下面这个Expandable "Detail" Table Rows教程由图老师小编精心推荐选出,过程简单易学超容易上手,喜欢就要赶紧get起来哦!

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)

(本文来源于图老师网站,更多请访问https://m.tulaoshi.com/webkaifa/)IDNameTotal123Bill Gates100 2007-01-02A short description15 2007-02-03Another description45 2007-03-04More Stuff40456Bill Brasky50 2007-01-02A short description10 2007-02-03Another description20 2007-03-04More Stuff20789Phil Upspace75 2007-01-02A short description33 2007-02-03Another description22 2007-03-04More Stuff20
展开更多 50%)
分享

猜你喜欢

Expandable "Detail" Table Rows

Web开发
Expandable "Detail" Table Rows

饮茶的"宜"与"忌"

养生 健康
饮茶的"宜"与"忌"

s8lol主宰符文怎么配

英雄联盟 网络游戏
s8lol主宰符文怎么配

用js怎么把&字符换成"&amp:"

Web开发
用js怎么把&字符换成"&amp:"

宝贝"挨打"让孩子打回去?

孩子
宝贝"挨打"让孩子打回去?

lol偷钱流符文搭配推荐

英雄联盟 网络游戏
lol偷钱流符文搭配推荐

远离"过劳死"小常识

生活常识 养生 健康
远离"过劳死"小常识

基于Java字符串 "==" 与 "equals" 的深入理解

编程语言 网络编程
基于Java字符串 "==" 与 "equals" 的深入理解

lolAD刺客新符文搭配推荐

英雄联盟
lolAD刺客新符文搭配推荐

不错的用外部Javascript修正特定网页内容

不错的用外部Javascript修正特定网页内容

iOS开发中UIImageView控件的常用操作整理

iOS开发中UIImageView控件的常用操作整理
下拉加载更多内容 ↓