Home > Back-end >  The json data written to the virualtree, how to solve the parent class repeat?
The json data written to the virualtree, how to solve the parent class repeat?

Time:11-18

There is a JSON
{
"Code" : "0",
"Data" : [
{
"Category" : "I am my parent class 1",
"Name" : "baidu,"
"Url" : "http:\/\/v.baidu.com/
"},
{
"Category" : "I am my parent class 2",
"Name" : "tencent video,"
"Url" : "http:\/\/v.qq.com"
},
{
"Category" : "I am my parent class 2",
"Name" : "iQIYI,"
"Url" : "http:\/\/v.iqiyi.com/
"},
{
"Category" : "I am my parent class 3,"
"Name" : "bilibili",
"Url" : "http:\/\/www.bilibili.com"
}
]
}

Can now through Qjson each content through cash out, now want to write to the virualtree, excuse me, there are two among the parent class is the same, how to judge the parent class, and then write the data as a subclass in? To face is written VIRUALTREE reference example, but write die
With mlvdtPlayList do
The begin
Try
BeginUpdate;
The Clear;
Node1:=AddChild (nil);//level node
PData:=GetNodeData (Node1);
PData ^. Caption:='I am the parent class 1;
PData ^. URL:=' ';
2:=AddChild (Node1);//secondary node, the same below
PData:=GetNodeData (2);
PData ^. Caption:='transition';
PData ^. URL:='http:\/\/v.baidu.com/';
The finally
EndUpdate;
end;
end;
  • Related