A query table registered via Queries.addTableDef. Wraps the name of a JavaScript function that supplies the table's rows, and the column headings declared for it, so it can be used as a data source for reports and admin table views.
Implements: Table
Properties
| Property | Returns | Description |
|---|---|---|
| description | String | The human readable name for this table, shown when choosing a data source. |
| headers | List<String> | The column headings declared for this table, in the order they were added. |
| tableId | String | The unique identifier this table was registered under. |
Inherited from Table
Methods
getRows(int start, Integer maxRows)
Returns: RowsResult
Reads a page of rows starting at the given row, discarding any progress status. Delegates to the three argument overload with a status callback that does nothing.
| Parameter | Description |
|---|---|
start | the zero based index of the first row to return |
maxRows | the maximum number of rows to return, or null for no limit |
getRows(int start, Integer maxRows, Consumer<String> status)
Returns: RowsResult
Reads a page of rows starting at the given row, reporting progress through the supplied callback. This is the core method every table implementation provides; the other getRows overloads delegate to it.
| Parameter | Description |
|---|---|
start | the zero based index of the first row to return |
maxRows | the maximum number of rows to return, or null for no limit |
status | callback invoked with progress messages while the rows are being read |
getRows(int start, Integer maxRows, Consumer<String> status, Map<String,Object> extraParams)
Returns: RowsResult
Reads a page of rows, optionally taking extra parameters that a specific table implementation can use to filter its results. The default implementation ignores extraParams and reads from row zero rather than the given start; implementations that use extraParams override this method directly.
| Parameter | Description |
|---|---|
start | the zero based index of the first row to return; not used by the default implementation |
maxRows | the maximum number of rows to return, or null for no limit |
status | callback invoked with progress messages while the rows are being read |
extraParams | implementation specific filter parameters; not used by the default implementation |
Methods
getHeaders()
Returns: List<String>
The column headings declared for this table, in the order they were added.
getTableId()
Returns: String
The unique identifier this table was registered under.
getDescription()
Returns: String
The human readable name for this table, shown when choosing a data source.
addHeader(String text)
Returns: QueryTable
Declares one column heading for this table, in call order. Used immediately after addTableDef to describe the columns returned by the table's JavaScript function.
| Parameter | Description |
|---|---|
text | the column heading text |
supportsPagination()
Returns: boolean
Whether this table's rows can be paged through, as declared with supportsPagination(boolean). True unless declared otherwise. This path is not handed start and maxRows as function arguments, so a table that pages reads them from the RowsResult it is given.
supportsPagination(boolean b)
Returns: QueryTable
Declares whether this table's rows can be paged through. Pass false for a table that aggregates, pivots, or must see every row to produce any: consumers then know not to offer a pager, and the table's admin page becomes export only.
| Parameter | Description |
|---|---|
b | true if this table supports paging, false if it always returns all rows |