{
 "hidden": false,
 "children": [{
  "configs": {
   "itemId": "module",
   "serverScript": "var result = {},\
  records = {},\
  record, nodes, rs, meta,data;\
data=app.get();\
rs=app.run(\"SELECT DISTINCT R.ID,\\
\" +\
                \"       R.TOPIC_NAME as \\\"text\\\", 'tree_icon' as \\\"iconCls\\\", \\
\" +\
                \"       R.TOPIC_DESCRIBE,\\
\" +\
                \"       R.TOPIC_PARENT_ID,\\
\" +\
                \"       R.TOPIC_PARENT_NAME,\\
\" +\
                \"       if(NVL(U.ID, '-')= '-', 'false', 'true') as \\\"checked\\\"\\
\" +\
                \" FROM TOPIC_RESP R\\
\" +\
                \"         LEFT JOIN TOPIC_USER_COL U\\
\" +\
                \"                   ON R.ID = U.TOPIC_RESP_ID AND U.USER_ID='\"+data.user+\"'\");\
meta = rs.getMetaData();\
\
while (rs.next()) {\
  record = Wb.getRecord(rs, meta);\
  nodes = records[record.TOPIC_PARENT_ID];\
  if (nodes) {\
    nodes.push(record);\
  } else {\
    nodes = [record];\
    records[record.TOPIC_PARENT_ID] = nodes;\
  }\
}\
\
function createNodes(items, parentMenu) {\
  items.children = records[parentMenu]||[];\
  if (items.children.length)\
    items.expanded = true;\
  Wb.each(items.children, function(item) {\
    createNodes(item, item.ID);\
  });\
}\
createNodes(result, '-');\
app.send(result);"
  },
  "expanded": true,
  "children": [],
  "type": "module"
 }],
 "roles": {"default": 1},
 "title": "",
 "iconCls": "",
 "inframe": false,
 "pageLink": ""
}