html - How do I add an expandable box of extra information to a table row that is created in an Angular repeat statement? -


i have table within angular app looks this:

<table id="visible_table" class="table table-hover table-striped">     <tr class="info">         ...     </tr>     <tr ng-repeat="x in environment_service_packages | filter:isenvironmentcorrect | orderby:'service'">         ...     </tr> </table> 

i wanting make each table row clickable information displayed below line's service. have information stored within model. can't seem formatting of data work, however.

my original idea put div @ end of second tr tag included within repeat. able information appear, each service's data appeared below table rather below table row expected.

i tried doing line break , doing td spanned across entire table, br didn't end changing page's layout whatsoever.

i considering turning each row simple div , removing table structure altogether, wanted check see if there better way first.

thanks.

you can use <tbody> iterate on <tr> elements:

function myctrl($scope) {    $scope.environment_service_packages =       [        {name: 'obj1', info: {text: 'some info obj1', show: true}},        {name: 'obj2', info: {text: 'some info obj2', show: false}},      ];  }
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>    <body ng-app>    <table ng-controller="myctrl" class="table table-hover table-striped">      <tr class="info">        <td>...</td>      </tr>      <tbody ng-repeat="x in environment_service_packages">        <tr ng-click="x.info.show = !x.info.show">          <td> {{ x.name }}        </tr>        <tr ng-show="x.info.show">          <td>            {{ x.info.text }}          </td>        </tr>      </tbody>    </table>  </body>


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -