如何实现具有不同子级标题的素数树表?我正在使用angular 7和priming V7数据如下:
{
"label":"Parent 1",
"data":{
"name":"Parent 1"
},
"children": this.resultData1
},
{
"label":"Parent 2",
"data":{
"name":"Parent 2"
},
"children": this.resultData2
}
子元素是
resultData1 : Array<any> = [
{data:{"status":"OK","AppId":"dsil1","GenId":"123"}},
{data:{"status":"OK","AppId":"dsil2","GenId":"124"}},
{data:{"status":"OK","AppId":"dsil3","GenId":"125"}},
{data:{"status":"OK","AppId":"dsil4","GenId":"126"}}
]
resultData2 : Array<any> = [
{data:{"ID":"123","print":"NO","execTime":"02-16-2020"}},
{data:{"ID":"124","print":"NO","execTime":"02-14-2020"}},
{data:{"ID":"125","print":"YES","execTime":"01-16-2020"}},
{data:{"ID":"126","print":"YES","execTime":"12-11-2019"}}
]
我不确定,我认为唯一的方法是让数据模型中的所有字段都可以为null。在树的一个级别上,您可以使用"name"字段作为treeTableToggler。
export interface Data {
name?: string;
status?: string;
AppId?: string;
GenId?: string;
ID?: string;
print?: string;
execTime?: string;
}
export interface TreeNodeModel {
data: Data;
children: Array<TreeNodeModel>;
}