使用p-treeTable,我能够基于检查存储值,在“编辑功能”中,我需要向Data显示曾经检查过的内容,我正在将数据发送到“ selectedNodeTest”,但未选中复选框。 请帮助我。
<p-treeTable [value]="gridData" [columns]="cols1" [(selection)]="selectedNodeTest">
<ng-template pTemplate="header" let-columns>
<tr>
<th *ngFor="let col of columns">
{{col.header}}
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-rowNode let-rowData="rowData" let-columns="columns">
<tr>
<td *ngFor="let col of columns; let i = index">
<p-treeTableToggler [rowNode]="rowNode" *ngIf="i == 0"></p-treeTableToggler>
<p-treeTableCheckbox selectionMode="checkbox" [value]="rowNode" *ngIf="i == 0" (click)="managementStructureClick(rowData)"></p-treeTableCheckbox>
{{rowData[col.field]}}
</td>
</tr>
</ng-template>
<ng-template pTemplate="summary">
<div style="text-align: left">
Selected Nodes: <span *ngIf="!selectedNodeTest || selectedNodeTest.length === 0" style="font-weight: normal">none</span>
<ul *ngIf="selectedNodeTest && selectedNodeTest.length">
<li *ngFor="let node of selectedNodeTest">
<span style="font-weight: normal">{{'Management Id:'+node.managementStructureId }}</span>
</li>
</ul>
</div>
</ng-template>
</p-treeTable>
在Ts。
localManagementSiteEditCollection: TreeNode[];
this.workFlowtService.getManagementSiteEditData(this.sourceSite.siteId).subscribe(data11 =>
{
this.localManagementSiteEditCollection = data11;
this.selectedNodeTest = this.localManagementSiteEditCollection;
console.log(this.selectedNodeTest);
})