2017-05-09 4 views
0

テーブルがあり、折りたたまれたアイテムがありますが、ここではhttp://jsfiddle.net/s4je5b0y/のように一度に1つしか表示しないようにしたいのですが、テーブルの作成方法はわかりません。 私は、データの親クラスが見えますが、私はテーブルでそれを使用することはできません、理由は分かりません。ありがとう。 ブートストラップテーブルの折りたたみ時に1つだけ開くことができます

私のコード:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 
 
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> 
 
<table class='table table-bordered table-condensed' style='border-collapse:collapse;background-color:white;'> 
 
\t \t \t \t \t <thead> 
 
\t \t \t \t \t \t <tr> 
 
\t \t \t \t \t \t \t <th>a</th> 
 
\t \t \t \t \t \t \t <th>b</th> 
 
\t \t \t \t \t \t \t <th>c</th> 
 
\t \t \t \t \t \t </tr> 
 
\t \t \t \t \t </thead> 
 
\t \t \t \t \t <tbody> 
 
\t \t \t \t \t \t <tr id='open0' data-target='#r0' class='accordion-toggle' data-toggle='collapse'> 
 
\t \t \t \t \t \t \t <td>0</td> 
 
\t \t \t \t \t \t \t <td></td> 
 
\t \t \t \t \t \t \t <td>2</td> 
 
\t \t \t \t \t \t </tr> 
 
\t \t \t \t \t \t <tr style='background-color:#e5e8e7;'> 
 
\t \t \t \t \t \t \t <td colspan='5' class='hiddenRow'> 
 
\t \t \t \t \t \t \t \t <div class='collapse ' id='r0'> 
 
\t \t \t \t \t \t \t \t \t asd 
 
\t \t \t \t \t \t \t \t </div> 
 
\t \t \t \t \t \t \t </td> 
 
\t \t \t \t \t \t </tr> 
 
\t \t \t \t \t \t <tr id='open1' data-target='#r1' class='accordion-toggle' data-toggle='collapse'> 
 
\t \t \t \t \t \t \t <td>0</td> 
 
\t \t \t \t \t \t \t <td></td> 
 
\t \t \t \t \t \t \t <td>2</td> 
 
\t \t \t \t \t \t </tr> 
 
\t \t \t \t \t \t <tr style='background-color:#e5e8e7;'> 
 
\t \t \t \t \t \t \t <td colspan='5' class='hiddenRow'> 
 
\t \t \t \t \t \t \t \t <div class='collapse ' id='r1'> 
 
\t \t \t \t \t \t \t \t \t asd 
 
\t \t \t \t \t \t \t \t </div> 
 
\t \t \t \t \t \t \t </td> 
 
\t \t \t \t \t \t </tr> 
 
\t \t \t \t \t \t <tr id='open1' data-target='#r2' class='accordion-toggle' data-toggle='collapse'> 
 
\t \t \t \t \t \t \t <td>0</td> 
 
\t \t \t \t \t \t \t <td></td> 
 
\t \t \t \t \t \t \t <td>2</td> 
 
\t \t \t \t \t \t </tr> 
 
\t \t \t \t \t \t <tr style='background-color:#e5e8e7;'> 
 
\t \t \t \t \t \t \t <td colspan='5' class='hiddenRow'> 
 
\t \t \t \t \t \t \t \t <div class='collapse ' id='r2'> 
 
\t \t \t \t \t \t \t \t \t asd 
 
\t \t \t \t \t \t \t \t </div> 
 
\t \t \t \t \t \t \t </td> 
 
\t \t \t \t \t \t </tr> 
 
\t \t \t \t \t </tbody> 
 
\t \t \t \t </table>

答えて

0

は、コードからのデータ・親の属性を削除し、それが動作しますが、この http://jsfiddle.net/s4je5b0y/1/

<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true"> 
    <div class="panel panel-default"> 
    <div class="panel-heading" role="tab" id="headingOne"> 
     <h4 class="panel-title"> 
     <a role="button" data-toggle="collapse" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne"> 
      Collapsible Group Item #1 
     </a> 
     </h4> 
    </div> 
    <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne"> 
     <div class="panel-body"> 
     Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. 
     </div> 
    </div> 
    </div> 
    <div class="panel panel-default"> 
    <div class="panel-heading" role="tab" id="headingTwo"> 
     <h4 class="panel-title"> 
     <a class="collapsed" role="button" data-toggle="collapse" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo"> 
      Collapsible Group Item #2 
     </a> 
     </h4> 
    </div> 
    <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo"> 
     <div class="panel-body"> 
     Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. 
     </div> 
    </div> 
    </div> 
    <div class="panel panel-default"> 
    <div class="panel-heading" role="tab" id="headingThree"> 
     <h4 class="panel-title"> 
     <a class="collapsed" role="button" data-toggle="collapse" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree"> 
      Collapsible Group Item #3 
     </a> 
     </h4> 
    </div> 
    <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree"> 
     <div class="panel-body"> 
     Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. 
     </div> 
    </div> 
    </div> 
</div> 
+0

を参照してください?私は、例からそれを削除するためではなく、私のテーブルにデータターゲットを追加したい! –

関連する問題