Tree data (JSON)

next to this property opens the Tree Control - JSON Data dialog. This dialog comes with a workspace where you can enter JSON directly. There are also three text buttons at the bottom of the dialog. Validate JSON examines any entered JSON for errors and Show in JSON Viewer gives a rough visual of the existing tree structure. The "Insert sample JSON" option enters the following JSON: "/>

Description

The Tree data (JSON) property appears after the "Tree data type" property is set to JSON. Clicking the next to this property opens the Tree Control - JSON Data dialog. This dialog comes with a workspace where you can enter JSON directly. There are also three text buttons at the bottom of the dialog. Validate JSON examines any entered JSON for errors and Show in JSON Viewer gives a rough visual of the existing tree structure. The "Insert sample JSON" option enters the following JSON:

[
	{
		html: 'a',
		collapsedIcon: 'images/$$application.firefox.png.a5image',
		expandedIcon: 'images/$$application.alpha.png.a5image',
		children: [
			{
				html: 'a-1',
				icon: 'images/$$application.chrome.png.a5image',
				onClick: function() { alert('click on a-1'); }
			},
			{
				html: 'a-2',
				onClick: function() { alert('click on a-2'); }
			},
			{
				html: 'a-3',
				onClick: function() { alert('click on a-3'); }
			}
		]
	},
	{
		html: 'b',
		onClick: function() { alert('click on b'); }
	},
	{
		html: 'c'
	}
]

Running this code in Live Preview looks like this:

images/json.png

Clicking on the dropdown results in the following:

images/json2.png

In the expandable part of this tree the firefox icon on the collapsed tree is replaced by the alpha icon once that branch of the tree is expanded.

images/json3.png
collapsedIcon: 'images/$$application.firefox.png.a5image'
images/json4.png
expandedIcon: 'images/$$application.alpha.png.a5image'

The onClick events produce a simple alert box:

{
				html: 'a-2',
				onClick: function() { alert('click on a-2'); }
			}
images/json5.png
The alert produced by clicking on a-2