繁体   English   中英

如何使用angular8切换行

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM