Class RapidContext.Widget.TableColumn

Extends: RapidContext.Widget

The table column widget class. Used to provide a sortable data table column, using a <th> HTML element for the header (and rendering data to <td> HTML elements).

Source code: RapidContext_Widget_TableColumn.js

Class Summary
 
Creates a new data table column widget.
Method Summary
 
setAttrs(attrs)
Updates the widget or HTML DOM node attributes.
Methods borrowed from class RapidContext.Widget:
addAll, addChildNode, addClass, animate, blurAll, destroy, disable, enable, getChildNodes, hasClass, hide, isDisabled, isHidden, removeAll, removeChildNode, removeClass, setStyle, show, toggleClass, uid
Class Detail
RapidContext.Widget.TableColumn(attrs)
Creates a new data table column widget.
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>
Parameters:
{Object} attrs
the widget and node attributes
{String} attrs.title
the column title
{String} attrs.field
the data property name
{String} attrs.type Optional
the data property type, one of string, number, date, time, datetime, boolean or object (defaults to string)
{String} attrs.sort Optional
the sort direction, one of asc, desc, none (disabled) or null (unsorted)
{Number} attrs.maxLength Optional
the maximum data length, overflow will be displayed as a tooltip, only used by the default renderer
{Boolean} attrs.key Optional
the unique key value flag, only to be set for a single column per table
{String} attrs.tooltip Optional
the tooltip text to display on the column header
{Function} attrs.renderer Optional
the function that renders the converted data value into a table cell, called as renderer(<td>, value, data) with the DOM node, field value and data object as arguments
Returns:
{Widget} the widget DOM node
Method Detail
setAttrs(attrs)
Updates the widget or HTML DOM node attributes. Note that some updates will not take effect until the parent table is cleared or data is reloaded.
Parameters:
{Object} attrs
the widget and node attributes to set
{String} attrs.title Optional
the column title
{String} attrs.field Optional
the data property name
{String} attrs.type Optional
the data property type, one of string, number, date, time, datetime, boolean or object
{String} attrs.sort Optional
the sort direction, one of asc, desc, none (disabled) or null (unsorted)
{Number} attrs.maxLength Optional
the maximum data length, overflow will be displayed as a tooltip, only used by the default renderer
{Boolean} attrs.key Optional
the unique key value flag, only to be set for a single column per table
{String} attrs.tooltip Optional
the tooltip text to display on the column header
{Function} attrs.renderer Optional
the function that renders the converted data value into a table cell, called as renderer(<td>, value, data) with the DOM node, field value and data object as arguments