I've been having a lot of hiccups making this work. Essentially I want to be able to click on a row on my table to expand that row and provide additional information within there. I want it to be a toggled accordion style (drawers), so I can open multiple at once. The code is below.
<div class="row">
<div class="col-md-11">
<table class="table table-hover table-bordered">
<thead>
<tr>
<th>S</th>
<th>R</th>
<th>Se</th>
<th>D</th>
<th>Ser</th>
<th>L</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="x in projects | filter:query | filter:quer | orderBy:orderProp">
<td><b>{{x.a}}</b></td>
<td>{{x.b}}</td>
<td><u>{{x.c}}</u></td>
<td>{{x.d}}</td>
<td>{{x.e}}</td>
<td>{{x.f}}</td>
</tr>
</tbody>
</table>
</div>
</div>
It forms a table with six columns which will loop through records and produce many sets of information. I want to be able to give these rows the ability to expand and collapse on click.
http://plnkr.co/edit/CO7ZHudbfR9TZxGTQfGZ
Thanks.
You may use angular-ui-bootstrap which provides a set of AngularJS directives based on Twitter Bootstrap's markup and CSS, and iterate through your data using ng-repeat
on <accordion>
.
<accordion-group ng-repeat="x in pro | orderBy:orderProp">
<accordion-heading>
<div class="row">
<div class="cell"><b>{{x.a}}</b></div>
<div class="cell">{{x.b}}</div>
<div class="cell"><u>{{x.c}}</u></div>
<div class="cell">{{x.d}}</div>
<div class="cell">{{x.e}}</div>
<div class="cell">{{x.f}}</div>
</div>
</accordion-heading>
<div>
Test Data
</div>
</accordion-group>
</accordion>
Further, you may use css to display tabular data
.table{
display: table;
width:100%
}
.row{
display: table-row;
}
.cell{
display: table-cell;
width:20%
}
The advantage of using ui-bootstrap is, it provide access to native AngularJS directives without any dependency on jQuery or Bootstrap's JavaScript.
Here's the updated plunkr
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With