将表格与 Angular

编程入门 行业动态 更新时间:2024-10-28 17:28:30
本文介绍了将表格与 Angular-UI Accordion 混合使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我正在尝试将一张桌子与 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.profilepany_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>{{ clientpany_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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-21 06:34:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/997806.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:表格   Angular

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!