Tree - Array Data
To implement a TreeView, you can use Json Array data rather than a hierarchical structure. Use setRows() to display data in Array format.
※ When creating the treeId value that constitutes the tree node, the number of digits (Length) of each Level must be the same.
※ Assuming that the number of nodes in one level is up to 999, treeId should be written as 001 to 999, not 1 to 999. Not only numbers but also letters can be used.
※ Based on the example below, if the treeId value of Seoul Metropolitan City is 2 digits, the number of digits of sibling nodes (Busan Metropolitan City, Gyeonggi-do, Gangwon-do, etc.) at the same level as Seoul Metropolitan City must also be 2 digits.
setRows()
treeProvider.setRows(data, "treeId", false, null, "iconField");
Array Data
This is JSON format data to implement a tree. In the example below, the treeId field contains hierarchy information.
[
{
"treeId": "11",
"treeName": "Seoul",
"area1code": "11",
"area1name": "Seoul",
"iconField": 0
},
{
"treeId": "11.010",
"treeName": "Jongno-gu",
"area1code": "11",
"area1name": "Seoul",
"area2code": "11010",
"area2name": "Jongno-gu",
"iconField": 1
},
{
"area1code": "11",
"area1name": "Seoul",
"area2code": "11010",
"area2name": "Jongno-gu",
"area3code": "1101053",
"area3name": "Sajik-dong",
"date1": "20160416",
"treeId": "11.010.53",
"treeName": "Sajik-dong"
},
{
"area1code": "11",
"area1name": "Seoul",
"area2code": "11010",
"area2name": "Jongno-gu",
"area3code": "1101054",
"area3name": "Samcheong-dong",
"treeId": "11.010.54",
"treeName": "Samcheong-dong"
},
{
"area1code": "11",
"area1name": "Seoul",
"area2code": "11010",
"area2name": "Jongno-gu",
"area3code": "1101055",
"area3name": "Buam-dong",
"treeId": "11.010.55",
"treeName": "Buam-dong"
},
....
];