RealGrid2 Guide
Tree
Tree icon1

tree icon

By specifying an icon for each tree node, you can display various icons on the nodes. To use a tree icon, set treeOptions.iconImagesRoot and iconImages in advance. For nodes where iconIndex is not specified, you can specify a default icon using treeOptions.defaultIcon.

   treeView.treeOptions.iconImagesRoot = "/images/flags/";
   treeView.treeOptions.iconImages = [
       "kr.png", "de.png", "es.png", "fr.png", "grd_treeicon_leaf.png", "hu.png", "is.png",
       "ox.png", "mx.png", "pt.png", "us.png", "ve.png"
   ]
   treeView.treeOptions.defaultIcon = 4;

Array Type

When importing search data, you must specify the iconIndex to display and retrieve the value. The retrieved iconIndex value is specified in the 5th param of setRows().

treeProvider.setRows(data, 'treeId', false, null, "iconField");
[
   {
     "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"
   },
...skip...

Object Type

When importing search data in the same way as Array Type, you must specify the iconIndex to display and retrieve the value. The imported iconIndex value is specified in the 4th param of setObjectRows().

treeProvider.setObjectRows(data, "rows", "", "icon");
{
   "rows": [{
       "icon": "0",
       "col0": "Man",
       "col1": "11723",
       "col2": "1258",
       "col3": "29500",
       "col4": "21401",
       "col5": "28261",
       "col6": "3732",
       "col7": "7393",
       "rows": [{
           "icon": "2",
           "col0": "Asia",
           "col1": "4244",
           "col2": "133",
           "col3": "11565",
           "col4": "5866",
           "col5": "9024",
           "col6": "2256",
           "col7": "4129",
...skip...