将表格与 Angular-UI Accordion 混合使用 [英] Mixing a Table with Angular-UI Accordion

查看:20
本文介绍了将表格与 Angular-UI Accordion 混合使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将一张桌子与 angular-ui 的手风琴混合在一起,但我想不出一种方法来做到这一点.我不是专业人士,编写指令.我想知道是否存在这样的桥梁.要实现这样的目标:

I'm trying to mix a table with angular-ui's accordion but I can't figure out a way to do it. I'm not a pro, writing directives. I wonder if such a bridge exist. To achieve something like this :

<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>

虽然它不起作用:(有没有人成功实现这样的目标?

Though it's not working :( Is there anyone who succeded to achieve something like this ?

我正在寻找的结果是当我点击表格中的一行时,它的行为与手风琴相同.

The result I'm looking for is for when I click on a line in the table, it does the same behavior of an accordion.

推荐答案

就我而言,我让它有点原始,但也许这对您来说也是一个很好的解决方案.看:

In my case I made it a bit primitive but maybe that would be a good solution for you as well. Look:

 <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>

这篇关于将表格与 Angular-UI Accordion 混合使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆