JsonTree.js - Documentation - Public Functions

Below is a list of all the public API functions that can be called from a JsonTree.js service.

Download Now

v4.4.0 - 8rd Nov 2024
Functions

Manage Instances:

refresh( elementId ):

Refreshes a JsonTree.js instance.
Fires: onRefresh
Parameter: elementId: string - The JsonTree.js element ID that should be refreshed.
Returns: Object - The JsonTree.js class instance.

refreshAll():

Refreshes all of the rendered JsonTree.js instances.
Fires: onRefresh
Returns: Object - The JsonTree.js class instance.

render( element, options ):

Renders an element using the options specified.
Parameter: element: Object - The element to render.
Parameter: options: Object - The options to use (refer to "Binding Options" documentation for properties).
Returns: Object - The JsonTree.js class instance.

renderAll():

Finds all new elements and renders them.
Returns: Object - The JsonTree.js class instance.

openAll( elementId ):

Opens all the nodes in a JsonTree.js instance.
Fires: onOpenAll
Parameter: elementId: string - The JsonTree.js element ID that should be updated.
Returns: Object - The JsonTree.js class instance.

closeAll( elementId ):

Closes all the nodes in a JsonTree.js instance.
Fires: onCloseAll
Parameter: elementId: string - The JsonTree.js element ID that should be updated.
Returns: Object - The JsonTree.js class instance.

backPage( elementId ):

Moves back a page (if array paging is enabled).
Fires: onBackPage
Parameter: elementId: string - The JsonTree.js element ID that should be updated.
Returns: Object - The JsonTree.js class instance.

nextPage( elementId ):

Moves forward a page (if array paging is enabled).
Fires: onNextPage
Parameter: elementId: string - The JsonTree.js element ID that should be updated.
Returns: Object - The JsonTree.js class instance.

getPageNumber( elementId ):

Returns the current page number (if array paging is enabled).
Parameter: elementId: string - The JsonTree.js element ID that should be updated.
Returns: number - The array page number.

Manage Binding Options

updateBindingOptions( elementId, newOptions ):

Updates the binding options that are assigned to a specific element.
Parameter: elementId: string - The JsonTree.js element ID that should be updated.
Parameter: newOptions: Object - All the binding options that should be set (refer to "Binding Options" documentation for properties).
Returns: Object - The JsonTree.js class instance.

getBindingOptions( elementId ):

Gets the binding options that are assigned to a specific element.
Parameter: elementId: string - The JsonTree.js element ID.
Returns: Object - The binding options.

Manage Data:

setJson( elementId, json ):

Sets the JSON data currently being displayed.
Fires: onSetJson
Parameter: elementId: string - The JsonTree.js element ID that should be updated.
Parameter: json: Object - The JSON that should be shown in the display (can be a string, or object).
Returns: Object - The JsonTree.js class instance.

getJson( elementId ):

Returns the JSON data currently being displayed.
Parameter: elementId: string - The JsonTree.js element ID.
Returns: Object - The JSON that is being displayed.

getSelectedJsonValues( elementId ):

Returns the JSON values that are selected in the display.
Parameter: elementId: string - The JsonTree.js element ID.
Returns: Object[] - The JSON values that are selected in the display.

Destroying:

destroy( elementId ):

Reverts an element to its original state (without render attributes).
Fires: onDestroy
Parameter: elementId: string - The Heat.js element ID to destroy.
Returns: Object - The JsonTree.js class instance.

destroyAll():

Reverts all rendered elements to their original state (without render attributes).
Fires: onDestroy
Returns: Object - The JsonTree.js class instance.

Configuration:

setConfiguration( newConfiguration ):

Sets the specific configuration options that should be used.
Parameter: newConfiguration: Options - All the configuration options that should be set (refer to "Configuration Options" documentation for properties).
Returns: Object - The JsonTree.js class instance.

Additional Data:

getIds():

Returns an array of element IDs that have been rendered.
Returns: string[] - The element IDs that have been rendered.

getVersion():

Returns the version of JsonTree.js.
Returns: string - The version number.