[英]how to toggle the row using angular8
i have multiple rows, if i open one row then i will not be able to toggle it, i mean it wont be closed unless the other row is clicked for viewing the inside data.我有多行,如果我打开一行,那么我将无法切换它,我的意思是除非单击另一行以查看内部数据,否则它不会关闭。 I must be able to toggle rows if i have not done anychanges to form, incase if i have made changes to that form, it must show me a confirmation message as it is showing currently.如果我没有对表单进行任何更改,我必须能够切换行,如果我对该表单进行了更改,它必须向我显示当前显示的确认消息。
TS: 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: HTML:
<a href="javascript:void(0);" (click)="editEo(eo,i)" class="accordion-toggle">+ </a>
Just replace the line:只需替换该行:
this.eoList[objIndex]['OpenCloseStatus'] = true;
with:和:
this.eoList[objIndex]['OpenCloseStatus'] = !this.eoList[objIndex]['OpenCloseStatus'];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.