Class MochiKit.Widget.TableColumn
Extends
MochiKit.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).
Defined in: Widget.js.
Constructor Attributes | Constructor Name and Description |
---|---|
MochiKit.Widget.TableColumn(attrs)
Creates a new data table column widget.
|
- Fields borrowed from class MochiKit.Widget:
- _id, Classes
Method Attributes | Method Name and Description |
---|---|
Handles click events on the column header.
|
|
_map(src, dst)
Maps the column field from one object onto another.
|
|
_render(obj)
Renders the column field value into a table cell.
|
|
setAttrs(attrs)
Updates the widget or HTML DOM node attributes.
|
- Methods borrowed from class MochiKit.Widget:
- _animQueueId, _createWidgetTreeElem, _eventHandler, _widgetMixin, addAll, addChildNode, addClass, animate, blurAll, createWidget, createWidgetTree, destroy, destroyWidget, emitSignal, getChildNodes, hasClass, hide, isFormField, isHidden, isWidget, removeAll, removeChildNode, removeClass, setStyle, show, toggleClass
Class Detail
MochiKit.Widget.TableColumn(attrs)
Creates a new data table column widget.
- 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"
- {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 with the TD DOM node and data value as arguments (in that order)
- Returns:
- {Widget} the widget DOM node
Method Detail
_handleClick()
Handles click events on the column header.
_map(src, dst)
Maps the column field from one object onto another. This method
will also convert the data depending on the column data type.
- Parameters:
- src
- the source object (containing the field)
- dst
- the destination object
_render(obj)
Renders the column field value into a table cell.
- Parameters:
- obj
- the data object (containing the field)
- Returns:
- the table cell DOM node
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 with the TD DOM node and data value as arguments (in that order)