class %ZEN.Component.tablePane
extends simpleTablePane
This component draws an HTML table based on the contents
of a query.
The data for the table can come from a pre-built class query,
an SQL statement, or the tablePane can create an SQL query automatically.
The properties of the tablePane, as well as the auxiliary classes,
%ZEN.Auxiliary.column, %ZEN.Auxiliary.condition, and
%ZEN.Auxiliary.parameter, let you control the behavior and
appearance of the tablePane.
Many of the characteristics of the tablePane are inherited from its
superclass, %ZEN.Component.simpleTablePane. Refer to it
for more details.
parameter DOMAIN = "%ZEN";
parameter SYSMODULE = "table";
If set, this indicates that this system component should be
placed in the given "module". A module is a grouping of components
within the same class package that share common include (js or css) files.
Note that certain root classes are implicitly placed within the "core"
module.
Classes outside of the Zen library should not set this, they should use
the MODULE instead.
property autoExecute
as %ZEN.Datatype.boolean [ InitialExpression = 1 ];
If true (the default), automatically re-execute the query for this
table when the user changes the value of a column filter.
If false, the query will only be re-executed when the
executeQuery is called.
property bodyHeight
as %ZEN.Datatype.length;
If present, this specifies the height
of the body section of the table.
property caption
as %ZEN.Datatype.caption;
Caption displayed for this table using the HTML caption element.
This is a localized value.
property cellSpacing
as %ZEN.Datatype.integer [ InitialExpression = 0 ];
Amount of spacing around cells in the table. The default is 0 (no extra space around table cells).
For a slight but noticeable separation, a useful value is 2.
property clearSnapshot
as %ZEN.Datatype.boolean(XMLPROJECTION="none",ZENSETTING=0) [ InitialExpression = 0 ];
Client-side, run-time flag that is set when client wants to force
re-execution of the table query when the table is in "snapshot" mode.
property columns
as list of %ZEN.Auxiliary.column(XMLPROJECTION="ELEMENT",XMLREF=1,XMLTYPECONSTRAINT="CHOICE");
List of column information objects.
Each object specifies additional details about a column
in the table.
property conditions
as list of %ZEN.Auxiliary.condition(XMLPROJECTION="ELEMENT",XMLREF=1,XMLTYPECONSTRAINT="CHOICE");
A list of conditions. These are special expression objects that
are evaluated to add data-dependent styles to the table.
property currColumn
as %ZEN.Datatype.string(ZENEXPRESSION=1);
This is the logical name of the most recently selected column
header. Typically this is used for sorting.
property currPage
as %ZEN.Datatype.integer [ InitialExpression = 1 ];
For snapshot mode, this is the number (1-based) of the current "page" within the snapshot
that is displayed.
property dataSource
as %ZEN.Datatype.string(VALUELIST=",query,columns") [ InitialExpression = "query" ];
Specifies where the data columns of the table come from.
"query" (the default)- columns are displayed for each column in the
data source query.
"columns" - only columns explicitly defined in the columns
list are displayed.
property extraColumnWidth
as %ZEN.Datatype.length [ InitialExpression = 30 ];
Width used for extra columns, such as row number, row selector, etc.
property filtersDisabled
as %ZEN.Datatype.boolean [ InitialExpression = 0 ];
If true, disable column filters (if any).
property fixedHeaders
as %ZEN.Datatype.boolean [ InitialExpression = 0 ];
If true, then the header of the table will stay in position when the body
of the table is scrolled.
property headerLayout
as %ZEN.Datatype.string(VALUELIST=",filtersOnTop,headersOnTop") [ InitialExpression = "filtersOnTop" ];
This property controls how to display the table header when
column filters are used.
- "filtersOnTop" - (the default) Display column filters above column headers.
- "headersOnTop" - Display column headers above filters.
property invalidMessage
as %ZEN.Datatype.caption [ InitialExpression = $$$Text("Invalid Date","%ZEN") ];
Localized "invalid date" message displayed by control.
property lastUpdate
as %ZEN.Datatype.string(XMLPROJECTION="none");
Time, in ODBC timestamp format, that the query for this table
was last executed. This is set on the server whenever the query is
for the tablePane is executed.
property msgNoResult
as %ZEN.Datatype.caption [ InitialExpression = $$$Text("No Results","%ZEN") ];
property nowrap
as %ZEN.Datatype.boolean [ InitialExpression = 1 ];
IE does not support CSS nowrap correctly so this flag provides
a way to control whether table cells allow word wrapping or not.
property onheaderClick
as %ZEN.Datatype.eventHandler;
onheaderClick event handler:
This event is fired when the user clicks on a column header.
The name of the column will be in the currColumn property.
property onkeypress
as %ZEN.Datatype.eventHandler;
onkeypress event handler:
If useKeys is true, then this event handler
code is run when the user presses a key within the tablePane.
property pageSize
as %ZEN.Datatype.integer [ InitialExpression = 0 ];
This is the number of items to display on
a single "page" of the table.
0, the default, means show all data on first page.
This can only be set to a non-zero value when the table
is in snapshot mode.
property parameters
as list of %ZEN.Auxiliary.parameter(XMLNAME="parameter",XMLPROJECTION="ELEMENT",XMLREF=1);
User-defined list of parameters. These values are passed on
to the user callback function that provides the query for this table.
property refreshRequired
as %ZEN.Datatype.boolean(XMLPROJECTION="none",ZENSETTING=0) [ InitialExpression = 0 ];
This property should be set to 1 by server-side methods that want to force
the query associate with the tablePane to be re-executed.
property rowCount
as %ZEN.Datatype.string(XMLPROJECTION="none",ZENSETTING=0);
If present, this is the number of rows returned by the current
query. This is calculated by the built-in query or the
automatic query.
Note: this is a string as it could be set to "" or "100+".
property showFilters
as %ZEN.Datatype.boolean [ InitialExpression = 1 ];
If true, display column filters (if any).
property showQuery
as %ZEN.Datatype.boolean(ZENEXPRESSION=1) [ InitialExpression = 0 ];
Server-side diagnostic flag. If true, display the query used
to get data for this table.
property showValueInTooltip
as %ZEN.Datatype.boolean [ InitialExpression = 0 ];
If true, then the tooltip (HTML title attribute) displayed
for cells within the table will display the current value of the cell.
property sortOrder
as %ZEN.Datatype.string(VALUELIST=",asc,desc",ZENEXPRESSION=1);
For sortable tables, this is the order to sort values within the
current column. Values can be "", "asc" (ascending), or "desc" (descending).
property useKeys
as %ZEN.Datatype.boolean [ InitialExpression = 0 ];
If true, then the tablePane will capture user keystrokes and use them
for simple table navigation.
property useSnapshot
as %ZEN.Datatype.boolean [ InitialExpression = 0 ];
If true, create a temporary snapshot of the query results.
This allows for paging and sorting without re-executing the query.
property valueColumn
as %ZEN.Datatype.string;
If defined, this is the name of the data column that provides
a logical value for a selected row.
method %AddColumn(pColumn As %ZEN.Auxiliary.column = "")
as %ZEN.Auxiliary.column
Add a new column definition to this tablePane.
If pColumn is not provided, this method will create
a new column object.
method %AddParameter(pParm As %ZEN.Auxiliary.parameter = "")
as %ZEN.Auxiliary.parameter
Add a new parameter definition to this tablePane.
If pParm is not provided, this method will create
a new parameter object.
method %CreateSnapshot(pTempID As %String, pRS As %ResultSet)
as %Status
Create a temporary snapshot file from a result set.
Assumes that result set has been created and executed.
Users should not call this method.
method %DrawCell(pMethod As %String, pName As %String, pSeed As %String)
as %Status
Invoke user method to provide contents for a cell
method %DrawFilter(pMethod As %String, pName As %String, pColInfo As %ZEN.Auxiliary.column)
as %Status
Invoke user method to provide contents for a column filter.
method %DrawHTML()
Draw innerHTML for this component (without enclosing div).
method %DrawTable(pRS As %ResultSet)
as %Status
Draw the table.
classmethod %IsTypeNumeric(pType As %Integer)
as %Boolean
Tests if a column type is a numeric type.
classmethod FetchRowFromSnapshot(pIndex As %Integer, pID As %String, pRow As %Integer, pCurrColumn As %String = "", pSortOrder As %String = "")
as %Boolean
[ ZenMethod ]
Internal method.
Fetch data from snapshot global and package up as a client object.
pIndex is index of client component.
pID is internal ID of snapshot global.
pRow is row number to fetch.
method addNavigator(nav)
[ Language = javascript ]
Associate a navigator component with this tablePane.
This is called by the navigator component.
method appendColumn(colName)
[ Language = javascript ]
Appends new column object to this table with the given
column name. Returns the new column object.
Call the executeQuery method after calling this
to update the table.
method applyFilters()
[ Language = javascript ]
If we are in autoExecute mode, then re-execute the query
for this table using the current value of any column filters.
If we are not in autoExecute mode, then do nothing.
method disableColumnFilters(flag)
[ Language = javascript ]
Disable (or enable) the column filters for this table.
method executeQuery(remember)
[ Language = javascript ]
Force query for this table to be executed on the server.
If the table is in snapshot mode, then a new snapshot will
be created.
If remember is true, then the table will
stay on the same page after the new results are displayed.
method filterChanged(filterName, refresh, type, index)
[ Language = javascript ]
User has changed the value of a filter.
filterName is the name of the filter.
refresh indicates if the query should be re-executed.
type (optional) is type of filter.
index (optional) is control index for filters with multiple controls.
method filterKeyPressed(evt, filterName, type, index)
[ Language = javascript ]
User has pressed a key within a filter.
method firstPage()
[ Language = javascript ]
For multi-page display, go to the first page.
method focus()
[ Language = javascript ]
Client-side method to input focus to this control.
method getColumnFilters()
[ Language = javascript ]
Get column filters (if there are any).
Returns an associative array containing the current
values of the filter controls indexed by column name.
method getFilterValue(cname)
[ Language = javascript ]
Get current value of column filter associated with column cname.
method getInsideWidth(element)
[ Language = javascript ]
method getPageCount()
[ Language = javascript ]
For multi-page display, calculate the number of pages.
method getRenderedRowData(row)
[ Language = javascript ]
Explore the DOM and extract the data for the specified phyiscal table row
(0-based) from the rendered table data (not to be confused with
the logical row number of the data itself in a multi-page table).
This data is packaged into a JavaScript object whose properties
correspond to the names of the columns in the table. If
showRowNumbers is true the object will also contain a property
called rowNum and will be contain the logical, enumerated row
of the result set record
This is a client-side only call and can query only the values of
the current page of the current table. The full, logical contents
of the table (in snapshot mode) resides at the server and logical
rows may be accessed using getRowData()
If there are not data columns to report or if the requested row is
greater than the page size for the table, this function returns null.
method getRowData(row)
[ Language = javascript ]
For tables in snapshot mode only.
Go to the server and fetch the data for the specified row
(0-based) from the table snapshot data. This data is packaged
into a JavaScript object whose properties correspond to the
names of the columns in the snapshot table.
For non-snapshot tables or out of range row numbers, returns null.
method gotoPage(page)
[ Language = javascript ]
For multi-page display, go to specified page (1 is first page), if possible.
method headerClick(name)
[ Language = javascript ]
User has clicked on a column header.
method lastPage()
[ Language = javascript ]
For multi-page display, go to the last page.
method nextPage(giveFocus)
[ Language = javascript ]
For multi-page display, go to next page, if possible.
method onloadHandler()
[ Language = javascript ]
When the page is loaded, check for alignment issues between the table header
and the table body.
method packRows()
[ Language = javascript ]
method packRowsIE()
[ Language = javascript ]
method previousPage(giveFocus)
[ Language = javascript ]
For multi-page display, go to previous page, if possible.
If giveFocus is true, then give focus back to
the hidden control.
method removeNavigator()
[ Language = javascript ]
Remove the navigator component with this tablePane.
This is called by the navigator component.
method resetColumnFilters()
[ Language = javascript ]
Reset the values of the column filters (if there are any).
method resizeHeaders()
[ Language = javascript ]
Under IE with fixedHeaders set to true, the table headers and the body
columns may become misaligned. This routine checks for alignment issues
in the rendered table and, if needed, reformats the header to accound for
the space taken up by a vertical scrollbar in the body of the table.
method setColumnFilters(state)
[ Language = javascript ]
Set the value of all column filters (if there are any).
state is an associative array containing the current
values of the filter controls indexed by column name (as
returned by getColumnFilters.
method setDateFilter(group)
[ Language = javascript ]
Set value of date filter box. index is 0 or 1 to indicate
which date box to set.
method setFilterValue(cname, value)
[ Language = javascript ]
Set the value of column filter associated with column cname.
method setOffsetWidth(element, width)
[ Language = javascript ]
method setProperty(property, value, value2)
[ Language = javascript ]
Set the value of a named property.
method showColumnFilters(flag)
[ Language = javascript ]
Show or hide columns filters (if there are any).
Users should use setProperty('showFilters',true) instead.
method showDateSelector(cname, index, type)
[ Language = javascript ]
Display date selector for a date filter box.
method tpKeyDownHandler(evt)
[ Language = javascript ]
Process key down event within the table's invisible edit control.
method tpKeyPressHandler(evt)
[ Language = javascript ]
Process key press event within the table's invisible edit control.