-
Notifications
You must be signed in to change notification settings - Fork 5
Table Renderer
Tobias Paczian edited this page Mar 27, 2018
·
3 revisions

Displays a browsable, filterable table with clickable cells / rows. A table is synchronous by default, meaning all data it displays is already in client memory. It can be set to be asynchronous, where you have to define the actions that occur when a navigation action is triggered. This method has to return the data after the navigation action, which then updates the table to the new state.
- target (HTML Container Element) Element to render the table in.
- width (INT) Width of the table.
- height (INT) Height of the table.
-
rows_per_page (INT)
The maximum number of table rows to be displayed at a time. Default is
10. -
sortcol (INT)
Zero based index of the row the table should be sorted by. Default is
0. -
sorted (BOOLEAN)
Enables / disabled initial sorting of the table by the sortcol. Default is
false. -
offset (INT)
Initial first row to display. Default is
0. -
invisible_columns (HASH)
Hash of column indices pointing at 1. Columns in this hash are not displayed. Default is
{} -
disable_sort (HASH)
Hash of column indices pointing at 1. Columns in this hash can not be sorted. Default is
{} -
sorttype (HASH)
Hash of column indices pointing at a sorttype. A sorttype can be either string or number. Default is
{} -
filter_autodetect (BOOLEAN)
If set to false will try to detect which filter type is most appropriate for each column. Default is
false. -
filter_autodetect_select_max (INT)
Maximum number of distinct entries in a column that will still autodetec the column filter as a select box. Default is
10. -
editable (HASH of BOOLEAN)
The key of the hash is the column index. If set to true, clicking a cell in this column will display an input field allowing to change the content of the cell. Default is
false. -
sort_autodetect (BOOLEAN)
If set to true will try to detect which sorttype is appropriate for each column. Default is
false. - filter (HASH) Hash of column indices pointing at filter objects. A filter object has the properties * searchword - the current entry in the search field * case_sensitive - boolean to turn on / off case sensitivity in filtering * operator - list of operators available in this filter * active_operator - selected operator * type - text, select or premade-select * options - premade-select only, a list of hashes with the keys "text" and "value"
-
hide_options (BOOLEAN)
Turns display of the options button on and off. Default is
false(the option button is visible). - onclick (FUNCTION) The function to be called when the table is clicked. This function will be passed the parameters (as an ordered list) * clicked_row - array of contents of the cells of the clicked row * clicked_cell - content of the clicked cell * clicked_row_index - zero based index of the clicked row * clicked_cell_index - zero based index of the clicked cell
-
edit_callback (FUNCTION)
The function to be called when a cell is edited. This function is passed the table data. It is organised as a list of hashes with each column name pointing at the value of the cell. Default is
false -
synchronous (BOOLEAN)
This is
trueby default. If set to false, the table expects its data to be set, filtered and browsed externally. It will issue a callback to the navigation callback function on any of those events, expecting an external data update. -
navigation_callback (FUNCTION)
The function to be called when a navigation / filter action is issued and the table is in asynchronous state (synchronous set to false). It will be passed either a string ("previous", "next", "first", "last") or an object that can contain one of the following structures:
* sort:
{ sort: $fieldname, dir: [ "asc" | "desc" ] }* query:[ { searchword: $filter_value, field: $column_name_to_search, comparison: $comparison_operator }, ... ]* goto:$row_index* limit:$number_of_rows_per_page -
minwidths (ARRAY of INT)
Sets the minimum widths of the columns in pixel, default is
1. -
maxwidths (ARRAY of INT)
Sets the maximum widths of the columns in pixel, default is
null -
show_export (BOOLEAN)
If true shows an export button that will download the table as a tab separated text file, default is
false -
export_filename (STRING)
File name to be set when downloading the table. Default is
table.csv -
strip_html (BOOLEAN)
If true strips html from cells before exporting them, default is
true -
data_manipulation (FUNCTION)
function to manipulate asynch data after it was retrieved and before it was rendered. Gets the data passed as an argument. Default is
false