The base table module for jviz.
You can install the tab
module using the jviz CLI:
jviz install tab
Do an ajax request to get the data of the table from the server. The ajax
options gets the following keys:
url
: (mandatory) sets the url to retrieve the data from the server.type
: sets the method to retrieve the data. Examples:GET
,POST
...parse
: afunction
to parse the retrieved data.
jviz.modules.tab({
"ajax":
{
"url": "data.json",
"type": "get",
"parse": function(d)
{
//Do something with the data and return the parsed data
//....
return d;
}
}
});
An array with the columns information.
An array with the data to display on the table.
jviz.modules.tab({
"data":
[
{ "name": "John", "age": 25 },
{ "name": "Susan", "age": 26 },
{ "name": "Bob", "age": 24 }
]
});
(Mandatory) Sets the parent element where the table must be builded.
Check a row.
Checks all rows of the table.
Uncheck a row.
Un-checks all rows of the table.
You can register a new event using the on
method. For example, with the following code
tab.on('click:head', function(){ /* ... */ });
the function provided will he called when the user clicks on some cell of the header.
This event will be executed when the user clicks on a cell of the header.
Emit the listener
function when the data is filtered. The function will be called with the following arguments:
length
: number of rows that have passed the filter.
Emit the listener
function when the filter is reset. The function will be called with the following arguments:
length
: number of rows of the original data.
Emit the listener
function when the data is ordered. The function will be called with the following arguments:
columns
: an array with the format{ key: 'COLUMN_KEY', order: 'ASC|DESC' }
, where each element of the array is the order of one column.
MIT LICENSE © The Jviz Team.