Titanium.UI.TableView

Object of Titanium.UI.
Platform Since
Android 0.8
iPhone 0.8
iPad 0.8
Mobile Web 1.8

Summary

A Table View allows you to create a scrollable table of content in a list-based fashion.

Description

A table view can contain a set of TableViewRows, each displaying an item of data. The default TableViewRow has properties for adding text, as well as optional images on the left and right sides, and various system-provided indicators, such as check marks. Table view rows can also be fully customized by adding child views, such as labels, buttons, or image views.

When adding rows to a table view, each row can be passed as a TableViewRow object, or as dictionary specifying the properties for a table row, in which case the TableView will create TableViewRow objects as needed.

Use the Titanium.UI.createTableView method to create a table view.

Code Examples

Simple Table View with Basic Rows

The most basic example of a table view.

var data = [{title:"Row 1"},{title:"Row 2"}];
var table = Titanium.UI.createTableView({data:data});
win.add(table);

Methods

Name Summary
add

Adds a child to this view's hierarchy.

addEventListener

Adds the specified callback as an event listener for the named event.

animate

Animates this view.

appendRow

Appends one or more rows to the table.

convertPointToView

Translates a point from this view's coordinate system to another view's coordinate system. (Android, iPhone, iPad only.)

deleteRow

Deletes an existing row.

deselectRow

Programmatically deselects a row. (iPhone, iPad only.)

fireEvent

Fires a synthesized event to any registered listeners.

getAllowsSelection

Gets the value of the allowsSelection property. (iPhone, iPad only.)

getAllowsSelectionDuringEditing

Gets the value of the allowsSelectionDuringEditing property. (iPhone, iPad only.)

getAnchorPoint

Gets the value of the anchorPoint property. (iPhone, iPad only.)

getAnimatedCenterPoint

Gets the value of the animatedCenterPoint property. (Android, iPhone, iPad only.)

getBackgroundColor

Gets the value of the backgroundColor property.

getBackgroundDisabledColor

Gets the value of the backgroundDisabledColor property. (Android only.)

getBackgroundDisabledImage

Gets the value of the backgroundDisabledImage property. (Android only.)

getBackgroundFocusedColor

Gets the value of the backgroundFocusedColor property. (Android only.)

getBackgroundFocusedImage

Gets the value of the backgroundFocusedImage property. (Android only.)

getBackgroundGradient

Gets the value of the backgroundGradient property. (iPhone, iPad, Mobile Web only.)

getBackgroundImage

Gets the value of the backgroundImage property.

getBackgroundLeftCap

Gets the value of the backgroundLeftCap property. (iPhone, iPad only.)

getBackgroundRepeat

Gets the value of the backgroundRepeat property. (iPhone, iPad only.)

getBackgroundSelectedColor

Gets the value of the backgroundSelectedColor property. (Android, Mobile Web only.)

getBackgroundSelectedImage

Gets the value of the backgroundSelectedImage property. (Android, Mobile Web only.)

getBackgroundTopCap

Gets the value of the backgroundTopCap property. (iPhone, iPad only.)

getBorderColor

Gets the value of the borderColor property.

getBorderRadius

Gets the value of the borderRadius property.

getBorderWidth

Gets the value of the borderWidth property.

getBottom

Gets the value of the bottom property.

getCenter

Gets the value of the center property.

getChildren

Gets the value of the children property.

getData

Gets the value of the data property.

getEditable

Gets the value of the editable property. (iPhone, iPad only.)

getEditing

Gets the value of the editing property. (iPhone, iPad only.)

getFilterAttribute

Gets the value of the filterAttribute property. (Android, iPhone, iPad only.)

getFilterCaseInsensitive

Gets the value of the filterCaseInsensitive property. (Android, iPhone, iPad only.)

getFocusable

Gets the value of the focusable property. (Android only.)

getFooterTitle

Gets the value of the footerTitle property.

getFooterView

Gets the value of the footerView property.

getHeaderTitle

Gets the value of the headerTitle property.

getHeaderView

Gets the value of the headerView property.

getHeight

Gets the value of the height property.

getIndex

Gets the value of the index property. (iPhone, iPad only.)

getKeepScreenOn

Gets the value of the keepScreenOn property. (Android only.)

getLayout

Gets the value of the layout property.

getLeft

Gets the value of the left property.

getMaxRowHeight

Gets the value of the maxRowHeight property.

getMinRowHeight

Gets the value of the minRowHeight property.

getMoving

Gets the value of the moving property. (iPhone, iPad only.)

getOpacity

Gets the value of the opacity property.

getRight

Gets the value of the right property.

getRowHeight

Gets the value of the rowHeight property.

getScrollable

Gets the value of the scrollable property. (iPhone, iPad only.)

getSearch

Gets the value of the search property. (Android, iPhone, iPad only.)

getSearchHidden

Gets the value of the searchHidden property. (iPhone, iPad only.)

getSeparatorColor

Gets the value of the separatorColor property.

getSeparatorStyle

Gets the value of the separatorStyle property. (iPhone, iPad, Mobile Web only.)

getShowVerticalScrollIndicator

Gets the value of the showVerticalScrollIndicator property. (iPhone, iPad only.)

getSize

Gets the value of the size property.

getSoftKeyboardOnFocus

Gets the value of the softKeyboardOnFocus property. (Android only.)

getStyle

Gets the value of the style property. (iPhone, iPad only.)

getTop

Gets the value of the top property.

getTouchEnabled

Gets the value of the touchEnabled property.

getTransform

Gets the value of the transform property.

getVisible

Gets the value of the visible property.

getWidth

Gets the value of the width property.

getZIndex

Gets the value of the zIndex property.

hide

Hides this view.

insertRowAfter

Inserts a row after another row.

insertRowBefore

Inserts a row before another row.

remove

Removes a child view from this view's hierarchy.

removeEventListener

Removes the specified callback as an event listener for the named event.

scrollToIndex

Scrolls the table view to ensure that the specified row is on screen.

scrollToTop

Scrolls the table to a specific top position where 0 is the topmost y position in the table view.

selectRow

Programmatically selects a row. (iPhone, iPad only.)

setAllowsSelection

Sets the value of the allowsSelection property. (iPhone, iPad only.)

setAllowsSelectionDuringEditing

Sets the value of the allowsSelectionDuringEditing property. (iPhone, iPad only.)

setAnchorPoint

Sets the value of the anchorPoint property. (iPhone, iPad only.)

setBackgroundColor

Sets the value of the backgroundColor property.

setBackgroundDisabledColor

Sets the value of the backgroundDisabledColor property. (Android only.)

setBackgroundDisabledImage

Sets the value of the backgroundDisabledImage property. (Android only.)

setBackgroundFocusedColor

Sets the value of the backgroundFocusedColor property. (Android only.)

setBackgroundFocusedImage

Sets the value of the backgroundFocusedImage property. (Android only.)

setBackgroundGradient

Sets the value of the backgroundGradient property. (iPhone, iPad, Mobile Web only.)

setBackgroundImage

Sets the value of the backgroundImage property.

setBackgroundLeftCap

Sets the value of the backgroundLeftCap property. (iPhone, iPad only.)

setBackgroundRepeat

Sets the value of the backgroundRepeat property. (iPhone, iPad only.)

setBackgroundSelectedColor

Sets the value of the backgroundSelectedColor property. (Android, Mobile Web only.)

setBackgroundSelectedImage

Sets the value of the backgroundSelectedImage property. (Android, Mobile Web only.)

setBackgroundTopCap

Sets the value of the backgroundTopCap property. (iPhone, iPad only.)

setBorderColor

Sets the value of the borderColor property.

setBorderRadius

Sets the value of the borderRadius property.

setBorderWidth

Sets the value of the borderWidth property.

setBottom

Sets the value of the bottom property.

setCenter

Sets the value of the center property.

setData

Sets the data in the table.

setEditable

Sets the value of the editable property. (iPhone, iPad only.)

setEditing

Sets the value of the editing property. (iPhone, iPad only.)

setFilterAttribute

Sets the value of the filterAttribute property. (Android, iPhone, iPad only.)

setFilterCaseInsensitive

Sets the value of the filterCaseInsensitive property. (Android, iPhone, iPad only.)

setFocusable

Sets the value of the focusable property. (Android only.)

setFooterTitle

Sets the value of the footerTitle property.

setFooterView

Sets the value of the footerView property.

setHeaderTitle

Sets the value of the headerTitle property.

setHeaderView

Sets the value of the headerView property.

setHeight

Sets the value of the height property.

setIndex

Sets the value of the index property. (iPhone, iPad only.)

setKeepScreenOn

Sets the value of the keepScreenOn property. (Android only.)

setLayout

Sets the value of the layout property.

setLeft

Sets the value of the left property.

setMaxRowHeight

Sets the value of the maxRowHeight property.

setMinRowHeight

Sets the value of the minRowHeight property.

setMoving

Sets the value of the moving property. (iPhone, iPad only.)

setOpacity

Sets the value of the opacity property.

setRight

Sets the value of the right property.

setRowHeight

Sets the value of the rowHeight property.

setScrollable

Sets the value of the scrollable property. (iPhone, iPad only.)

setSearch

Sets the value of the search property. (Android, iPhone, iPad only.)

setSearchHidden

Sets the value of the searchHidden property. (iPhone, iPad only.)

setSeparatorColor

Sets the value of the separatorColor property.

setSeparatorStyle

Sets the value of the separatorStyle property. (iPhone, iPad, Mobile Web only.)

setShowVerticalScrollIndicator

Sets the value of the showVerticalScrollIndicator property. (iPhone, iPad only.)

setSoftKeyboardOnFocus

Sets the value of the softKeyboardOnFocus property. (Android only.)

setStyle

Sets the value of the style property. (iPhone, iPad only.)

setTop

Sets the value of the top property.

setTouchEnabled

Sets the value of the touchEnabled property.

setTransform

Sets the value of the transform property.

setVisible

Sets the value of the visible property.

setWidth

Sets the value of the width property.

setZIndex

Sets the value of the zIndex property.

show

Makes this view visible.

toImage

Returns an image of the rendered view, as a Blob. (Android, iPhone, iPad only.)

updateRow

Updates an existing row, optionally with animation

Properties

Name Type Summary
allowsSelection Boolean

True if the rows can be selected. (iPhone, iPad only.)

allowsSelectionDuringEditing Boolean

True if the rows can be selected while editing the table. (iPhone, iPad only.)

anchorPoint Point

Anchor point where animation should occur, relative to the view's boundaries. (iPhone, iPad only.)

animatedCenterPoint Point

Current position of the view during an animation. (Android, iPhone, iPad only.) read-only

backgroundColor String

Background color of the view.

backgroundDisabledColor String

Disabled background color of the view. (Android only.)

backgroundDisabledImage String

Disabled background image for the view, specified as a local file path or URL. (Android only.)

backgroundFocusedColor String

Focused background color of the view. (Android only.)

backgroundFocusedImage String

Focused background image for the view, specified as a local file path or URL. (Android only.)

backgroundGradient Gradient

A background gradient for the view. (iPhone, iPad, Mobile Web only.)

backgroundImage String

Background image for the view, specified as a local file path or URL.

backgroundLeftCap Number

Size of the left end cap. (iPhone, iPad only.)

backgroundRepeat Boolean

Toggle for whether or not to tile a background across a view. (iPhone, iPad only.)

backgroundSelectedColor String

Selected background color of the view. (Android, Mobile Web only.)

backgroundSelectedImage String

Selected background image url for the view, specified as a local file path or URL. (Android, Mobile Web only.)

backgroundTopCap Number

Size of the top end cap. (iPhone, iPad only.)

borderColor String

Border color of the view.

borderRadius Number

Border radius of the view.

borderWidth Number

Border width of the view.

bottom Number or String

View's bottom position, in platform-specific units.

center Point

View's center position, in the parent view's coordinates.

children Array<Titanium.UI.View>

Array of this view's child views. read-only

data Array<Titanium.UI.TableViewRow> or Array<Titanium.UI.TableViewSection>

Array of objects to be used for the rows of the table view.

editable Boolean

Allow the user to edit the table view (this must be true for swipe-to-delete). (iPhone, iPad only.)

editing Boolean

Boolean to control the editing state of the table view. (iPhone, iPad only.)

filterAttribute String

Filter attribute to be used when searching. (Android, iPhone, iPad only.)

filterCaseInsensitive Boolean

Boolean to indicate if the search should be case sensitive or case insensitive. (Android, iPhone, iPad only.)

focusable Boolean

Whether view should be focusable while navigating with the trackball. (Android only.)

footerTitle String

Table view footer title.

footerView Titanium.UI.View

Table view footer as a view that will be rendered instead of a label.

headerTitle String

Table view header title.

headerView Titanium.UI.View

Table view header as a view that will be rendered instead of a label.

height Number or String

View height, in platform-specific units.

index Array<TableViewIndexEntry>

Array of objects (with title and index properties) to control the table view index. (iPhone, iPad only.)

keepScreenOn Boolean

Whether to keep the device screen on. (Android only.)

layout String

Specifies how the view positions its children. One of: 'absolute', 'vertical', or 'horizontal'.

left Number or String

View's left position, in platform-specific units.

maxRowHeight Number

Maximum row height for table view rows.

minRowHeight Number

Minimum row height for table view rows.

moving Boolean

Boolean to control the moveable state of the table view. (iPhone, iPad only.)

opacity Number

Opacity of this view, from 0.0 (transparent) to 1.0 (opaque).

right Number or String

View's right position, in platform-specific units.

rowHeight Number

Default row height for table view rows.

scrollable Boolean

If true, the tableview can be scrolled. (iPhone, iPad only.)

search Titanium.UI.SearchBar

Search field to use for the table view. (Android, iPhone, iPad only.)

searchHidden Boolean

Boolean to control the visibility of the search field. (iPhone, iPad only.)

separatorColor String

Separator color between rows, specified as a hex or named value.

separatorStyle Number

Separator style constant. (iPhone, iPad, Mobile Web only.)

showVerticalScrollIndicator Boolean

Whether table view displays vertical scroll indicator (iPhone, iPad only.)

size Object

Rendered size of the view as a dictionary of width and height properties. read-only

softKeyboardOnFocus Number

Determines keyboard behavior when this view is focused. (Android only.)

style Number

Style of the table view, specified using one of the constants from Titanium.UI.iPhone.TableViewStyle. (iPhone, iPad only.)

top Number or String

The view's top position.

touchEnabled Boolean

Whether view should receive touch events.

transform Titanium.UI.2DMatrix or Titanium.UI.iOS.3DMatrix

Transformation matrix to apply to the view.

visible Boolean

Boolean value indicating whether the view is visible.

width Number or String

View's width, in platform-specific units.

zIndex Number

Z index position relative to other sibling views.

Events

Name Summary
click

Fired when a table row is clicked by the user.

delete

Fired when a table row is deleted by the user.

move

Fired when a table row is moved by the user.

scroll

Fired when the table view is scrolled.

scrollEnd

fired when the table view stops scrolling

touchcancel

Fired when a touch event is interrupted by the device.

touchend

Fired when a touch event is completed.

touchmove

Fired as soon as the device detects movement of a touch.

touchstart

Fired as soon as the device detects a touch gesture.