问题描述
我有一组固定装置,已根据其日期分为几组。然后,每组将单独的灯具输出到垫子桌子中。
我已经成功地通过mat-dialog更新了灯具,并且redux工具显示该灯具在商店中已更新。但是,数据不会在可观察的数组或数据源中更新。
我感谢其他人遇到了mat-table无法反映更新商店的问题-但由于我的数据源是在* ngFor Iterable(下面的代码)中定义的,所以找不到解决方案。
我还想知道是否有更好的方法来遍历灯具组,并且由于数据集很大,因此想避免每次都重新渲染整个表集的解决方案。
fixture-listing-component.html
<div class="col-12" *ngFor="let group of fixtures$ | async">
<h5>{{ group[0]?.matchDate | date: 'EEEE d MMMM yyyy' }}</h5>
<div class="row mb-5">
<table class="w-100" mat-table [dataSource]="group">
<!-- ngContainer columns -->
fixture-listing-component.ts
ngOnInit() {
this.store.pipe(
select(selectCurrentSeasonId)
).subscribe(seasonId => {
this.store.dispatch(loadMatches({seasonId}));
this.fixtures$ = this.store.pipe(
select(selectAllMatches),filter(arr => arr.length > 0),take(1),mergeMap(fixtures => fixtures),groupBy(fixture => moment(fixture.matchDate).format('YYYY-MM-DD')),mergeMap(group => group.pipe(toArray())),toArray()
);
});
}
版本
Angular Core 8.3.19
角材料8.2.3
NgRx 10.0.0
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)