[英]how to toggle the row using angular8
我有多行,如果我打開一行,那么我將無法切換它,我的意思是除非單擊另一行以查看內部數據,否則它不會關閉。 如果我沒有對表單進行任何更改,我必須能夠切換行,如果我對該表單進行了更改,它必須向我顯示當前顯示的確認消息。
演示: 演示
TS:
editEo(eo,index) {
if(this.eoInfoForm.dirty) {
this.confirmationDialogService.confirm('Please confirm..', 'Do you really want to save changes ?')
.then((confirmed) => {
let openedIndex = this.eoList.findIndex(obj => obj.OpenCloseStatus === true);
confirmed ? this.OpenCloseEvent(eo,openedIndex):this.OpenCloseEvent(eo,index);
if(confirmed){
console.log("works")
}
})
.catch(() => console.log('User dismissed the dialog (e.g., by using ESC, clicking the cross icon, or clicking outside the dialog)'));
}else {
// this.eoDetailsList = previous;
eo.isCollapse = !eo.isCollapse
this.OpenCloseEvent(eo,index);
}
}
HTML:
<a href="javascript:void(0);" (click)="editEo(eo,i)" class="accordion-toggle">+ </a>
只需替換該行:
this.eoList[objIndex]['OpenCloseStatus'] = true;
和:
this.eoList[objIndex]['OpenCloseStatus'] = !this.eoList[objIndex]['OpenCloseStatus'];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.