2017-06-08 82 views
0

我想顯示信息在一個表內使用一個按鈕來顯示和隱藏每行中的數據使用行的id,但由於我有2 ng重複,第一個循環完成之前第二,因此,所有的數據都顯示在同一行:這裏是我的代碼:ng重複和摺疊表

<div class="table-responsive"> 
    <table class="table table-bordered table-hover table-striped"> 
    <thead> 
    <tr> 
    <th></th> 
    <th>Projet</th> 
    <th>Responsable Apitech</th> 
    <th>Temps Passé</th> 
    </tr> 
    </thead> 
    <tbody> 
    <tr ng-repeat-start="p in projetsListe" > 
     <td> 
     <button class="btn btn-xs" ng-click="expanded = !expanded" expand data-toggle="collapse" id="{{p.IdProjet}}" data-target=".{{p.IdProjet}}"> 
     <span ng-bind="expanded ? '-' : '+'"></span> 
     </button> 
     </td> 
     <td>{{p.NomProjet}}</td> 
     <td>{{p.ResponsableApitech}}</td> 
     <td>Temps Passé</td> 
     </tr> 
     <tr ng-repeat-end ng-show="expanded"> 
     <td></td> 
     <td colspan="6"> 
     <table class="table table-condensed table-bordered"> 
      <thead> 
      <th></th> 
      <th>Tache</th> 
      <th>Collaborateur</th> 
      <th>Date</th> 
      <th>Temps Passé</th> 
      </thead> 
      <tbody> 
      <tr ng-repeat= "ft in ftListesorted" ng-show="expanded" class="collapse {{ft.IdProjet}}"> 
      <td><i class="glyphicon glyphicon-plus"></i></td> 
      <td>{{ft.NomTache}}</td> 
      <td>{{ft.NomCollaborateur}}</td> 
      <td>{{ft.Datefeuillestemps | date : 'dd/MM/yyyy' }}</td> 
      <td>{{ft.TempsPasse}}</td>  
      </tr> 
      </tbody> 
     </table> 
     </td> 
    </tr> 
</tbody> 
</table> 

這是我嘗試實現:http://embed.plnkr.co/qqNGSbw6oLUZbKqVQVpG/?show=preview

在我的情況:enter image description here

這是我所得到的,而不是: enter image description here

如果第二圖像中注意到獲得第一和第二排的信息,同時我想seperatly每一行的信息。

下面是該問題的一個例子的plunker:https://plnkr.co/edit/pPcPipLK0TltnOC60SSf

回答

0

expanded創建屬性的每一行。更改此行

<button class="btn btn-xs" ng-click="p.expanded = !p.expanded" expand data- 
    toggle="collapse" id="{{p.IdProjet}}" data-target=".{{p.IdProjet}}"> 

<tr ng-repeat-end ng-show="p.expanded"> 
+0

還是一樣的結果:( – Jihane

+0

你''。刪除ng-show – aseferov

+0

仍然是同樣的問題:/ – Jihane