已解决-HTML中只需要更改一行代码,并且
for loop
在.ts文件中可以完全删除。
特别感谢杰托和阿拉贡在评论部分指出了我的正确方向,以及来自葡萄柚城(wijmo)的sharad对最终答案的支持。
为了你
WIJMO
FlexGrid
伙计们,我刚出发
*ngIf
对我
items.deleted
HTML中的属性(类似于Aragron在编写时提出的建议:
'It looks like the data you are getting already has the deleted attribute, just use that.'
)
HTML:
<wj-flex-grid-column [header]="'delete/undelete buttons'" [binding]="'buttons'">
//// set *ngIf="!item.deleted" ////
<button *ngIf="!item.deleted; else unDeleted">Delete</button>
<ng-template #unDeleted>
<button>Un-Delete</button>
</ng-template>
</wj-flex-grid-column>
TS:
loadData() {
var self = this;
this.myDatabaseService.get(this.myApiPath)
.subscribe
(
data => {
this.setCollectionView(data);
this.m_collectionView.trackChanges = true;
//// for loop was not needed ////
},
errorCode => {
// this.statusMessage = "";
}
);
}