RapidContext
Access > Discovery > Insight
www.rapidcontext.com
Extends:
RapidContext.Widget
The table widget class. Used to provide a sortable and scrolling
data table, using an outer <div> HTML element around a <table>. The
Table widget can only have TableColumn child nodes, each providing a
visible data column in the table.
Source code:
RapidContext_Widget_Table.js
RapidContext.Widget.Table(attrs)
Creates a new data table widget.
|
addChildNode(child)
Adds a single child table column widget to this widget.
|
|
Adds the specified row id values to the selection.
|
|
clear()
Clears all the data in the table.
|
|
getCellElem(row, col)
Returns a table cell element.
|
|
getColumnIndex(field)
Returns the column index of a field.
|
|
getData()
Returns an array with the data in the table.
|
|
getIdKey()
Returns the unique key identifier column field, or null if none
was set.
|
|
Returns the number of rows in the table.
|
|
getRowId(index)
Returns the row id for the specified row index.
|
|
Returns the currently selected row data.
|
|
Returns the currently selected row ids.
|
|
Returns the current sort key for the table.
|
|
redraw()
Redraws the table from updated source data.
|
|
removeChildNode(child)
Removes a single child table column widget from this widget.
|
|
Removes the specified row id values from the selection.
|
|
setAttrs(attrs)
Updates the widget or HTML DOM node attributes.
|
|
setData(data)
Sets the table data.
|
|
setIdKey(key)
Sets the unique key identifier column field.
|
|
Sets the selection to the specified row id values.
|
|
sortData(field, direction)
Sorts the table data by field and direction.
|
onclear()
Emitted when the table data is cleared.
|
|
onselect()
Emitted when the table selection changes.
|
JavaScript:
var attrs1 = { field: "id", title: "Identifier", key: true, type: "number" };
var attrs2 = { field: "name", title: "Name", maxLength: 50, sort: "asc" };
var attrs3 = { field: "modified", title: "Last Modified", type: "datetime" };
var col1 = RapidContext.Widget.TableColumn(attrs1);
var col2 = RapidContext.Widget.TableColumn(attrs2);
var col3 = RapidContext.Widget.TableColumn(attrs3);
var exampleTable = RapidContext.Widget.Table({}, col1, col2, col3);
RapidContext.Util.registerSizeConstraints(exampleTable, "50%", "100%");
User Interface XML:
<Table id="exampleTable" w="50%" h="100%">
<TableColumn field="id" title="Identifier" key="true" type="number" />
<TableColumn field="name" title="Name" maxLength="50" sort="asc" />
<TableColumn field="modified" title="Last Modified" type="datetime" />
</Table>
none,
oneor
multiple), defaults to
one
none,
oneor
multiple)
var data = [ { id: 1, name: "John Doe", modified: "@1300000000000" }, { id: 2, name: "First Last", modified: new Date() }, { id: 3, name: "Another Name", modified: "2004-11-30 13:33:20" } ]; table.setData(data);
ascor
desc