How to: use Recordset variable and to_json function for populating a tree node
Example:
<!DOCTYPE html>
<html>
<head>
<title>HT/SQL SHOWCASE (LOCATIONS TREE VIEW)</title>
</head>
<body>
<center>
<controlblock control-block-name="controlblock">
<input name="show_all" type="button" value="All in one"/>
<input name="show_deps" type="button" value="Departments"/>
<input name="show_grid" type="button" value="Locations (Grid View)"/>
<input name="show_tree" type="button" value="Locations (Tree View)"/>
<input name="show_colors" type="button" value="Colors"/>
<input name="show_users" type="button" value="Users"/>
<br />
<br />
<input name="commit" type="button" value="Commit"/>
<input name="rollback" type="button" value="Rollback"/>
|-|
<input name="create-record" type="button" value=" + "/>
<input name="delete-record" type="button" value=" - "/>
|-|
<input name="first-page" type="button" value="<<"/>
<input name="prev-page" type="button" value=" < "/>
<input name="next-page" type="button" value=" > "/>
<input name="last-page" type="button" value=" >> "/>
|-|
<input name="enter-query" type="button" value="Enter Query"/>
<input name="execute-query" type="button" value="Execute Query"/>
<input name="cancel-query" type="button" value="Cancel Query"/>
|-|
<input name="kill-session" type="button" value="Log Out" redirect-url="/site/pages/deps/logon.frmx"/>
<br />
<br />
</controlblock>
<table style="width: 850px">
<tr>
<td style="vertical-align: top; width: 275px">
<controlblock control-block-name="cbTree">
<tree id="data"></tree>
</controlblock>
</td>
<td style="vertical-align: top; width: 250px">
<datablock data-block-name="countries" data-schema-name="htsql" data-source-name="countries"
order-by-clause="country_name" record-count="10" show-hide-mode="display" master-data-block-name="Session">
<table>
<thead>
<tr>
<td>COUNTRY ID</td>
<td>COUNTRY NAME</td>
<td>REGION ID</td>
</tr>
</thead>
<tbody>
<tr>
<td>
<input name="country_id" data-type="char" column-name="country_id" style="width: 50px"
type="text" />
</td>
<td>
<input name="country_name" data-type="char" style="width: 150px"
column-name="country_name" type="text"/>
</td>
<td>
<input name="region_id" data-type="char" style="width: 50px"
column-name="region_id" type="text" master-item-name="selectedNodeId"/>
</td>
</tr>
</tbody>
</table>
</datablock>
<datablock data-block-name="provinces" data-schema-name="htsql" data-source-name="provinces"
order-by-clause="province_name" record-count="10" show-hide-mode="display" master-data-block-name="Session">
<table>
<thead>
<tr>
<td>PROVINCE ID</td>
<td>PROVINCE NAME</td>
<td>COUNTRY ID</td>
</tr>
</thead>
<tbody>
<tr>
<td>
<input name="province_id" column-name="province_id" sequence-name="htsql.htsql"
type="text" style="width: 50px"/>
</td>
<td>
<input name="province_name" column-name="province_name" type="text" style="width: 150px"/>
</td>
<td>
<input name="country_id" column-name="country_id" type="text" style="width: 50px"
master-item-name="selectedNodeId"/>
</td>
</tr>
</tbody>
</table>
</datablock>
<datablock data-block-name="counties" data-schema-name="htsql" data-source-name="counties"
order-by-clause="county_name" record-count="10" show-hide-mode="display" master-data-block-name="Session">
<table>
<thead>
<tr>
<td>COUNTY ID</td>
<td>COUNTY NAME</td>
<td>PROVINCE ID</td>
</tr>
</thead>
<tbody>
<tr>
<td>
<input name="county_id" column-name="county_id" sequence-name="htsql.htsql"
type="text" style="width: 50px"/>
</td>
<td>
<input name="county_name" column-name="county_name" type="text" style="width: 150px"/>
</td>
<td>
<input name="province_id" column-name="province_id" type="text" style="width: 50px"
master-item-name="selectedNodeId"/>
</td>
</tr>
</tbody>
</table>
</datablock>
</td>
</tr>
</table>
</center>
</body>
</html>See also:
Last updated