【问题标题】:Expand and collapse table row in angular material在角材料中展开和折叠表格行
【发布时间】:2018-07-24 08:52:05
【问题描述】:

以下是仅发生扩展的示例,但我希望在您单击该行时折叠它。

https://stackblitz.com/edit/angular-material-expandable-table-rows?file=app%2Ftable%2Ftable.component.ts

我希望我的桌子是这样的:

请帮忙。

【问题讨论】:

    标签: angular angular-material


    【解决方案1】:

    替换 (click)="expandedElement = row"

    (click)="expandedElement === row? expandedElement = null : expandedElement = row"

    https://stackblitz.com/edit/angular-material-expandable-table-rows-8ypyfu?file=app%2Ftable%2Ftable.component.html

    【讨论】:

    • 它的工作!非常感谢:)
    • 嗨@yousef你知道如何放弃向上和向下箭头图标,所以当我点击任何行时它应该切换。
    • @Priyanka 您可以使用ngClassngStyle 添加条件css。您已经具备上述条件的地方。它应该是直截了当的。
    • {{ expandElement ? 'keyboard_arrow_down' : 'keyboard_arrow_up' }} 这条线工作正常,但每一行都在变化.. 它应该为点击的特定行而变化
    • {{expandedElement === 行? 'keyboard_arrow_up' : 'keyboard_arrow_down' }}
    猜你喜欢
    • 2017-07-11
    • 2020-09-24
    • 2023-02-19
    • 2018-03-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多