TableView

Labels: :IA_Function:IA_TableView

The TableView Function renders data in a table format.

Function parameters

Key Description Default value Possible values
$area The area in which the View is rendered. content content|sidebar-right|sidebar_left
#data An array of records to display
$column * Column settings
#columns.[col_identifier].data * Data for the column if the column does not take data from #data parameter
$column.[col_identifier].hidden * Column is hidden false
$column.[col_identifier].index * Column order
$column.[col_identifier].label * Column header label
$column.[col_identifier].values * Key from #data object record to take the column values from
$container.id The id of the container in which the View is rendered. If set to _new , a new container will be created each time the function is triggered. Assigned by system. a..zA..Z0..9_
$container.height The height of the container in pixels. positive integer
$container.width The width of the container in pixels. positive integer
$options General table options. This parameter is used to set initialization properties for the jqWidgets Data Table. The documentation for them can be found here.

Events

A TableView has the following events:

Each of these events generates its own event data object. The structure of these event data objects is given below.

rowClick

This event is triggered when a user clicks on a row in the table, and creates an event object of the following structure:

{
	"type": "rowClick",          // type
	"data": {}                   // row data
}

context (row)

This event is triggered when a user selects an option in the table row's context menu, and creates an event object of the following structure:

{
	"type": "context",           // type
	"menu": "row",               // menu
	"action": "Menu label",      // menu option
	"target": {}                 // row data
}

batch *

This event is triggered when a button in the button-bar is clicked, and creates an event object of the following structure:

{
	"type": "batch",              // type
	"action": "Button label",     // caption of the button
	"index": 1,                   // order of the option
	"selection": []               // array of {row data} objects
}

Example

The example below is taken from the standard setup of InterActor. A Neo4jQuery retrieves the trail of nodes that the user has visited, and sends the data to a TableView. When the user clicks a row in the Nodehistory TableView, another Neo4jQuery is executed.

NetworkView example

On the incoming trigger, the (%).data from the success event of the Neo4jQuery is mapped to the #data Function parameter of the TableView.

On the outgoing trigger, the (%).data.nodeid value is mapped to the $params.id function parameter of the second Neo4jQuery. This trigger is only executed when there is a rowClick event.

A more generic description of triggers is available on the Triggers page.

* not available in Community Edition