I am currently building a component in which permissions must be associated, these are generated by a service dynamically, in this way, there are "sections" (Sections) which have a parentId with their respective children (views), my service returns the following JSON.
[{
"Sub": [
{
"permission_id": 4,
"permission": "DBConnection",
"description": "DBConnection page",
"routeurl": "dbconnect",
"classs": "",
"icon": "",
"translate": "",
"module_id": 1,
"parentid": 5,
"childid": 13,
"is_active": true,
"navegation_url": "",
"type": "",
"created_by": "claudiab",
"created_at": "29/09/2020",
"updated_by": "",
"updated_at": "29/09/2020",
"sort_order": 0
},
{
"permission_id": 9,
"permission": "SelectedClause",
"description": "SelectedClause page",
"routeurl": "selectedClause",
"classs": "",
"icon": "",
"translate": "",
"module_id": 1,
"parentid": 5,
"childid": 15,
"is_active": true,
"navegation_url": "",
"type": "",
"created_by": "claudiab",
"created_at": "29/09/2020",
"updated_by": "",
"updated_at": "29/09/2020",
"sort_order": 0
},
{
"permission_id": 10,
"permission": "Retrievebk",
"description": "Retrievebk page",
"routeurl": "retrievebk",
"classs": "",
"icon": "",
"translate": "",
"module_id": 1,
"parentid": 5,
"childid": 14,
"is_active": true,
"navegation_url": "",
"type": "",
"created_by": "claudiab",
"created_at": "29/09/2020",
"updated_by": "",
"updated_at": "29/09/2020",
"sort_order": 0
}
],
"Section": "Configuration",
"parentId": 5
},
..... ]
I'm trying to integrate the NzTreeModule library that makes it easy to select and deselect parents according to selected children(https://ng.ant.design/components/tree/en) .... but I haven't really been able to integrate it, it dynamically generates the number of sections I have, but it's not bringing the names or their children. Someone could help me implement it, I'd assault him a lot.
html:
<nz-tree
[nzData]="data"
nzCheckable
nzMultiple
[nzCheckedKeys]="defaultCheckedKeys"
[nzExpandedKeys]="defaultExpandedKeys"
[nzSelectedKeys]="defaultSelectedKeys"
(nzClick)="nzEvent($event)"
(nzExpandChange)="nzEvent($event)"
(nzCheckBoxChange)="nzEvent($event)"
>
</nz-tree>
Aucun commentaire:
Enregistrer un commentaire