//Instantiate the table, passing as arguments an arbitrary identifier and the container var table = new JavaScripTable("jst", "tableContainer"); //Add the columns to the table table.addColumn(new Column("Name", JST_TYPE_STRING)); table.addColumn(new Column("Age", JST_TYPE_NUMERIC)); table.addColumn(new Column("Sex", JST_TYPE_STRING)); //Add the rows table.addRow(new Row(1, ["John Smith", 35, "male"])); table.addRow(new Row(2, ["Mary Anne", 29, "female"])); //Render the table table.render();
Name | Type | Default | Description |
---|---|---|---|
id | String | This is a unique id for the table | |
container | Object | A reference to the HTML element, or element name or id, that will contain the table | |
width | String | The value of JST_DEFAULT_WIDTH constant | The width property |
align | String | The value of JST_DEFAULT_ALIGN constant | The align property |
border | String | The value of JST_DEFAULT_BORDER constant | The border property |
padding | String | The value of JST_DEFAULT_PADDING constant | The padding property |
spacing | String | The value of JST_DEFAULT_SPACING constant | The spacing property |
Basic properties | |
container | A reference to the HTML element, or element name or id, that will contain the table |
id | This is a unique id for the table |
Appearance and Comportamental properties | |
align | The align property |
ascSort | Boolean value indicating whether the sort is in ascending (true) or descending (false) order |
border | The border property |
columnHeaderHighlighting | The highlighting mode for column headers |
cropRepeated | If set to true, don't display repeated values on contiguous rows |
cropRepeatedTree | If set to true, don't display repeated values on contiguous rows and columns, tracking dependent data |
identifierName | Used to build an ObjectRowMapper, where, in that case, will map the object identifier name |
mapperClassName | Used to build an ObjectRowMapper, where, in that case, will use this class to instantiate objects |
mapperConstructorArguments | Used to build an ObjectRowMapper, where, in that case, will use this array as the constructor arguments |
maxRows | If set to a non-negative number, will limit the number of rows in the table |
navigation | Defines the table's navigation bar options |
onRender | A callback function triggered every time the table is rendered |
onSelectionChange | A callback function triggered when the user changes the row selection |
operationMode | Defines whether the paging will be done in the client-side or in the server side |
padding | The padding property |
pageOnlySelectAll | This flag indicates if the selectAll() method (that is called when the selection type=multiple and the user clicks the header checkbox) will select all rows on current page only (true) or on every page (false) |
pageSize | When using paging, it's the row number on each page |
printing | Indicates whether the table is on printing mode, where many features are disabled, like highlighting and the navigation bar |
rowCount | The callback for table update events |
rowFunction | The name of the function called when the user clicks a row |
rowHighlighting | The highlighting mode for rows |
selectionType | Defines the row selection type |
showColumnHeaders | A flag indicating whether the column headers will be shown |
showSelectAll | Indicates whether the table will display a 'master' checkbox for selecting / deselecting all rows when the selection type is JST_SEL_MULTI |
sortColumn | The column index that is used for sort |
spacing | The spacing property |
updateTableFunction | The callback for table update events when in server mode |
usePaging | Defines the whether the table will display paged results (true) or all results (false) |
width | The width property |
Style classes properties | |
additionalFooterClass | The name of the table additional footer's style class |
additionalHeaderClass | The name of the table additional header's style class |
columnHeaderClass | The name of the column header style class |
columnHeaderTextClass | The name of the column header text style class |
editControlClass | The name of the table cells' edition controls style class |
editControlRadioCheckboxClass | The name of the table cells' edition controls style class when edit control is a radio or checkbox |
evenRowCellClass | The name of even row cells style class |
evenRowClass | The name of even rows style class |
evenRowTextClass | The name of even row text style class |
evenRowTextWithFunctionClass | The name of even row texts style class when it has a cellFunction |
footerClass | The name of the table footer's style class |
headerClass | The name of the table header's style class |
highlightedColumnHeaderClass | The name of the column header style class when the mouse is over it |
highlightedColumnHeaderTextClass | The name of the column header text style class when the mouse is over it |
highlightedEvenRowCellClass | The name of even row cells style class when the mouse is over it |
highlightedEvenRowClass | The name of even rows style class when the mouse is over it |
highlightedEvenRowTextClass | The name of even row text style class when the mouse is over it |
highlightedEvenRowTextWithFunctionClass | The name of even row text style class when it has a cellFunction and the mouse is over it |
highlightedNavigationLinkClass | The name of the table's navigation bar link style class when the mouse is over it |
highlightedOddRowCellClass | The name of odd row cells style class when the mouse is over it |
highlightedOddRowClass | The name of odd rows style class when the mouse is over it |
highlightedOddRowTextClass | The name of odd row text style class when the mouse is over it |
highlightedOddRowTextWithFunctionClass | The name of odd row text style class when it has a cellFunction and the mouse is over it |
invalidEditControlClass | The name of the table cells' edition controls style class when the user types an invalid data |
navigationClass | The name of the table's navigation bar style class |
navigationLinkClass | The name of the table's navigation bar link style class |
oddRowCellClass | The name of odd row cells style class |
oddRowClass | The name of odd rows style class |
oddRowTextClass | The name of odd row text style class |
oddRowTextWithFunctionClass | The name of odd row texts style class when it has a cellFunction |
selectionControlClass | The name of the table's selection controls style class |
tableClass | The name of the <TABLE> element's style class |
Text properties | |
emptyTableText | If set, is the text displayed when the table is empty |
footerText | The text for the table's footer |
headerText | The text for the table's header |
waitText | If set, is the text displayed when the table is being rendered |
Label properties | |
ascLabel | Appears besides the sorting column's header when it's sorting in ascending order |
descLabel | Appears besides the sorting column's header when it's sorting in descending order |
falseLabel | Displayed on a boolean false value |
trueLabel | Displayed on a boolean true value |
Data separators properties | |
columnSeparator | The separator to be used when between columns |
rowSeparator | The separator to be used when between rows |
valueSeparator | The separator to be used when a cell has multiple values (it's value is an Array) |
Data parsers properties | |
booleanParser | The default boolean parser |
currencyParser | The default currency parser |
dateParser | The default date parser |
numberParser | The default number parser |
stringParser | The default string parser |
Encoding parsers properties | |
booleanEncodingParser | The default boolean encoding parser |
currencyEncodingParser | The default currency encoding parser |
dateEncodingParser | The default date encoding parser |
numberEncodingParser | The default number encoding parser |
stringEncodingParser | The default string encoding parser |
Custom messages properties | |
changePageDescription | Message displayed in the browser's status bar when the user hovers on the navigation's link to change the current page |
changePagePrompt | Message propted to the user when changing the current page |
changePageSizeDescription | Message displayed in the browser's status bar when the user hovers on the navigation's link to change the page size |
changePageSizePrompt | Message propted to the user when changing the page size |
firstPageDescription | Message displayed in the browser's status bar when the user hovers on the navigation's link to the first page |
firstPageText | Text on the navigation bar to the first page's link |
invalidColumnMessage | Message when an invalid column is being added to the table |
invalidRowIdMessage | Message when an row with an invalid identifier is being added to the table |
invalidRowMessage | Message when an an invalid row is being added to the table |
invalidTableContainerMessage | Message when the table was created using an invalid container |
invalidTableIdMessage | Message when the table was created using an invalid identifier |
lastPageDescription | Message displayed in the browser's status bar when the user hovers on the navigation's link to the last page |
lastPageText | Text on the navigation bar to the last page's link |
messagesOnStatusBar | When set to true, show messages on the status bar instead of in tooltips |
multipleRowText | Navigation bar's text when there are multiple rows in the table |
nextPageDescription | Message displayed in the browser's status bar when the user hovers on the navigation's link to the next page |
nextPageText | Text on the navigation bar to the next page's link |
pageText | Navigation bar's text when using paging |
previousPageDescription | Message displayed in the browser's status bar when the user hovers on the navigation's link to the previous page |
previousPageText | Text on the navigation bar to the previous page's link |
rowIdAlreadyInUseMessage | Message when the identifier of the row being added is already in use by another row |
showAllDescription | Message displayed in the browser's status bar when the user hovers on the navigation's link to show all rows |
showAllText | Text on the navigation bar to the show all's link |
singleRowText | Navigation bar's text when there is a single row in the table |
sortMessage | Message displayed in the browser's status bar when the cursor is above a sortable columnMessage displayed in the browser's status bar when the cursor is above a sortable column |
tableNotInitializedMessage | Message when the the table's render() method is called, and the table's mandatory properties were not correctly set |
topDescription | Message displayed in the browser's status bar when the user hovers on the navigation's link to the table's top anchor |
topText | Text on the navigation bar to the anchor to the table's top link |
usePagingDescription | Message displayed in the browser's status bar when the user hovers on the navigation's link to show paged rows |
usePagingText | Text on the navigation bar to the use paging's link |
Rendering Methods | |
render | Renders the table |
update | Updates the table after any modifications |
Column Manipulation Methods | |
addColumn | Adds the column to the table |
getAllColumns | Returns all table columns |
getColumnByIndex | Return the column with the specified index |
getColumnCount | Returns the number of columns on the table |
getSortColumn | Returns the current sort column |
getVisibleColumns | Returns all table visible columns |
removeAllColumns | Removes all table columns |
removeColumn | Removes a table column |
Row Manipulation Methods | |
addRow | Adds the row to the table |
getAllRowIds | Returns all row identifiers |
getAllRows | Returns all rows |
getRowById | Returns the specified row |
getRowCount | Returns the row count |
getSelectedRowCount | Returns the selected row count |
getSelectedRowIds | Returns the selected row identifiers |
getSelectedRows | Returns the selected rows |
removeAllRows | Removes all rows |
removeRowById | Removes the row with the specified id |
removeSelectedRows | Removes all selected rows |
updateRow | Update the row on the table |
Header and Footer Methods | |
addFooter | Adds a footer row, returning it |
addHeader | Adds a header row, returning it |
clearFooters | Removes all footer rows |
clearHeaders | Removes all header rows |
getFooter | Returns the footer associated with the given index |
getFooterCount | Returns the number of additional footer rows |
getHeader | Returns the header associated with the given index |
getHeaderCount | Returns the number of additional header rows |
Data Manipulation Methods | |
encode | Encodes the data on a single String |
getAllRowsAsObjects | The rows converted into objects using the table's ObjectRowMapper |
getCellValue | Returns the value of the specified cell |
getFormattedCellValue | Returns the formatted value of the specified cell |
getObjectRowMapper | Returns an ObjectRowMapper for the table |
getRowByIdAsObject | Returns the specified row, converted into object using the table's ObjectRowMapper |
getSelectedRowsAsObjects | Returns the selected rows converted into objects using the table's ObjectRowMapper |
setCellValue | Sets the value of the specified cell |
setFormattedCellValue | Sets the formatted value of the specified cell |
Navigation Methods | |
changePage | Sets the current page |
changePageSize | Sets the current page size |
setPage | Sets the table current page, updating the table |
setSort | Sets the column to sort data, updating the table |
setUsePaging | Sets if rows will be paged (true) or displayed all at once (false), updating the table |
Misc Methods | |
getMaxPage | Returns the last visible page |
getRowCount | Returns number of rows on the table |
selectAll | Makes all rows to be selected or not, according to the specified flag |
setSelection | Makes the row with the specified id to be selected or not, according to the specified flag |
Highlighting helper methods | |
buildHighlightingConstant | Return the constant for the given parts |
buildHighlightingParts | Return the parts for the given constant |
getColumnHeaderHighlightingParts | Returns the column header highlighting parts |
getRowHighlightingParts | Returns the row highlighting parts |
setColumnHeaderHighlightingParts | Sets the column header highlighting with individual parts |
setRowHighlightingParts | Sets the row highlighting with individual parts |
container
A reference to the HTML element, or element name or id, that will contain the table |
id
This is a unique id for the table |
booleanParser
The default boolean parser |
currencyParser
The default currency parser |
dateParser
The default date parser |
numberParser
The default number parser |
stringParser
The default string parser |
addRow
Adds the row to the table. The row id must be unique Arguments
|
||||||||||||
getAllRowIds
Returns all row identifiers |
||||||||||||
getAllRows
Returns all rows |
||||||||||||
getRowById
Returns the specified row Arguments
|
||||||||||||
getRowCount
Returns the row count |
||||||||||||
getSelectedRowCount
Returns the selected row count |
||||||||||||
getSelectedRowIds
Returns the selected row identifiers |
||||||||||||
getSelectedRows
Returns the selected rows |
||||||||||||
removeAllRows
Removes all rows Arguments
|
||||||||||||
removeRowById
Removes the row with the specified id Arguments
|
||||||||||||
removeSelectedRows
Removes all selected rows Arguments
|
||||||||||||
updateRow
Update the row on the table. If the row id does not exist on the table, nothing happens Arguments
|
addFooter
Adds a footer row, returning it. Any arguments will be passed on to the JavaScripTableCellContainer class |
addHeader
Adds a header row, returning it. Any arguments will be passed on to the JavaScripTableCellContainer class |
clearFooters
Removes all footer rows |
clearHeaders
Removes all header rows |
getFooter
Returns the footer associated with the given index |
getFooterCount
Returns the number of additional footer rows |
getHeader
Returns the header associated with the given index |
getHeaderCount
Returns the number of additional header rows |
encode
Encodes the data on a single String. If the data is an Array, join the values with the table's rowSeparator. If the array items are Row instances, their encode() method is called. The columns to be encoded may also be specified, as well as if the row id will be encoded or not Arguments
|
||||||||||||||||||||
getAllRowsAsObjects
The rows converted into objects using the table's ObjectRowMapper. When the table has no mapper, the array will contain Row instances |
||||||||||||||||||||
getCellValue
Returns the value of the specified cell Arguments
|
||||||||||||||||||||
getFormattedCellValue
Returns the formatted value of the specified cell. The column parser is used to format the value Arguments
|
||||||||||||||||||||
getObjectRowMapper
Returns an ObjectRowMapper for the table. If the table identifierName is not set, return null |
||||||||||||||||||||
getRowByIdAsObject
Returns the specified row, converted into object using the table's ObjectRowMapper. When the table has no mapper, the return will be the Row itself Arguments
|
||||||||||||||||||||
getSelectedRowsAsObjects
Returns the selected rows converted into objects using the table's ObjectRowMapper. When the table has no mapper, the array will contain Row instances |
||||||||||||||||||||
setCellValue
Sets the value of the specified cell Arguments
|
||||||||||||||||||||
setFormattedCellValue
Sets the formatted value of the specified cell. The column parser is used to parse the String Arguments
|
changePage
Sets the current page. If the page is not specified, prompts the user for the page Arguments
|
||||||||||||
changePageSize
Sets the current page size. If the size is not specified, prompts the user for the size Arguments
|
||||||||||||
setPage
Sets the table current page, updating the table. Only for client-side operation Arguments
|
||||||||||||
setSort
Sets the column to sort data, updating the table. Only for client-side operation Arguments
|
||||||||||||
setUsePaging
Sets if rows will be paged (true) or displayed all at once (false), updating the table. Only for client-side operation Arguments
|
getMaxPage
Returns the last visible page |
||||||||||||
getRowCount
Returns number of rows on the table |
||||||||||||
selectAll
Makes all rows to be selected or not, according to the specified flag Arguments
|
||||||||||||
setSelection
Makes the row with the specified id to be selected or not, according to the specified flag Arguments
|
buildHighlightingConstant
Return the constant for the given parts Arguments
|
||||||||||||||||||||
buildHighlightingParts
Return the parts for the given constant Arguments
|
||||||||||||||||||||
getColumnHeaderHighlightingParts
Returns the column header highlighting parts |
||||||||||||||||||||
getRowHighlightingParts
Returns the row highlighting parts |
||||||||||||||||||||
setColumnHeaderHighlightingParts
Sets the column header highlighting with individual parts Arguments
|
||||||||||||||||||||
setRowHighlightingParts
Sets the row highlighting with individual parts Arguments
|