2014-10-27 47 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