如何解决父和子复选框的选择
我正在一个页面上分配不同角色的权限,因此,我的nvbar中存在每个部分的父级和子级列表。我正在尝试做: 当用户选择父节时,应选中所有复选框 当用户选择一个父节但取消选择该组之一时,应取消选择父节 当用户取消选择父级时,应取消选中所有子级复选框。
我正在尝试使用check属性,更改状态(对或错) 分配了一个特定的动态ID进行检查,但不适用于我。 我对如何实现它感到困惑。如果有人可以帮助我,我真的会很感激
<!-- Here will go the sections -->
<nz-collapse>
<nz-collapse-panel
*ngFor="let parent of this.userMngmtService.getNvBar() let i = index"
[nzHeader]="parent.Section"
[nzActive]="parent.is_active"
[nzExtra]="extraTpl"
[nzDisabled]="parent.disabled">
<p style="margin:0;">
<label class="checkbox-inline">
<input type="checkbox" [value]="parent.parentId" (change)="viewParentSelected($event,i)">View
</label>
<label class="checkbox-inline">
<input type="checkbox" value="">Edit
</label>
<label class="checkbox-inline">
<input type="checkbox" value="">Delete
</label>
</p>
<!-- SubSection -->
<nz-collapse>
<nz-collapse-panel
*ngFor="let child of this.userMngmtService.getNvBar()[i].Sub"
[nzHeader]="child.permission"
[nzActive]="child.is_active"
[nzExtra]="extraTpl"
[nzDisabled]="child.disabled"
>
<p style="margin:0;">
<label class="checkbox-inline">
<input type="checkbox" [value]="child.permission_id" (change)="viewChildSelected($event,i)" id="'checkedBox'+i">View
<!-- <input type="checkbox" [value]="child.permission_id" (change)="viewChildSelected($event)" >View -->
</label>
<label class="checkbox-inline">
<input type="checkbox" value="">Edit
</label>
<label class="checkbox-inline">
<input type="checkbox" value="">Delete
</label>
</p>
</nz-collapse-panel>
</nz-collapse>
<!-- SubSection End -->
</nz-collapse-panel>
</nz-collapse>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。