本文介绍了当我首先过滤然后对表格进行分组时,垫表中的行消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我不过滤时,mat-table 中的分组工作正常.
当过滤或将焦点放在搜索栏上时,表格会被过滤,但是如果我取消组合它,垫表的行就会消失.
请帮助我提供一个解决方案,即使在我对其进行过滤后,该解决方案也可以对表格进行分组或取消分组.
当我首先将焦点放在过滤器搜索栏上时,即使在分组时也会出现此问题.
当我为搜索栏设置过滤器时,我认为问题在于过滤器谓词.

Grouping in mat-table works fine when I don't filter it.
When filtered or put focus on search bar, the table gets filtered but then if I ungroup it, the rows of mat table disappear.
Please help me with a solution which groups or ungroups the table even after I filter it.
This problem occurs even while grouping when I put focus on filter search bar first.
I think the problem is with filter predicate when I setup filter for search bar.

这是工作堆栈闪电战链接:
https://stackblitz.com/edit/xwcnz?file=src%2Fapp%2Fapp.component.ts

Here is the working stack blitz link:
https://stackblitz.com/edit/xwcnz?file=src%2Fapp%2Fapp.component.ts

推荐答案

StackBlitz.

我已经删除了你的过滤器分配,然后它就可以工作了.

I've removed your filter assignment and then it's working.

this.dataSource.filter = performance.now().toString();

我很困惑.什么是性能?

无论如何,我认为您的过滤和分组现在都运行良好.

Anyways, I think your filtering and grouping both are working perfectly now.

这篇关于当我首先过滤然后对表格进行分组时,垫表中的行消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-25 22:26