2014-10-27 71 views
6

我正在嘗試與angular-ui的手風琴混合使用表格,但我無法想出辦法做到這一點。 我不是專業人員,寫指令。我想知道這座橋是否存在。爲了實現這樣的事情:用Angular-UI手風琴混合表格

<table class="table table-hover table-condensed" thead> 
    <thead> 
     <tr> 
      <th>{{ data.profile.firstname }}</th> 
      <th>{{ data.profile.lastname }}</th> 
      <th>{{ data.profile.email }}</th> 
      <th>{{ data.profile.company_name }}</th> 
      <th>{{ data.profile.city }}</th> 
     </tr> 
    </thead> 
    <tbody accordion close-others="true"> 
     <!-- <tr ng-repeat="client in clients" ng-click="goTo('profile/' + client.username);"> --> 
     <tr ng-repeat="client in clients" accordion-group is-open="client.isOpen"> 
      <accordion-heading> 
       <td>{{ client.firstname }}</td> 
       <td>{{ client.lastname }}</td> 
       <td>{{ client.email }}</td> 
       <td>{{ client.company_name }}</td> 
       <td>{{ client.city }}</td> 
      </accordion-heading> 
      Accordion Content 
     </tr> 
    </tbody> 
</table> 

雖然它不工作:(是否有任何人誰succeded實現這樣的

我在尋找的結果是,當我點擊一條線表,它手風琴的相同的行爲

回答

9

在我來說,我做了一個有點原始,但也許這將是你一個很好的解決方案,以及看:。

<tbody ng-repeat="person in people | orderBy:predicate:reverse" > 
    <tr ng-click="isOpen=!isOpen"> 
    <td>{{person.name}}</td> 
    <td>{{person.job}}</td> 
    <td>{{person.age}}</td> 
    <td>{{person.grade}}</td> 
    </tr> 
    <tr ng-if="isOpen"> 
    <td>Just an empty line</td> 
    </tr> 
    </tbody> 
+0

爲了確保只有一個手風琴保持開放的時間,在你按Ctrl聲明本(由下面Mohideen·本·穆罕默德·啓發) 然後,你可以做這樣的事情(你可以使用l2等額外的水平): ​​{{person.name}} ​​{{person.job}} ​​{{person.age}} ​​{{person.grade}} ​​只是一個空行 – Maksym 2016-10-14 20:23:38

4

1)您可以嘗試div,而不是主要手風琴的table。這個對我有用。

2)這裏是 table在JSFiddle下面的例子,我希望它能幫助你。 ;: $ scope.expanded = {-1 L1:} http://jsfiddle.net/Pixic/VGgbq/

+2

通常不鼓勵在沒有解釋堆棧溢出應答的情況下連接到外部站點。用相關的代碼片段在這裏解釋解決方案。鏈接到小提琴作爲一種方式來看到它的一切行動。 – toolbear 2015-06-18 10:52:27