Titanium.UI.TableView

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

Summary

A Table View allows you to create a scrollable table of content in a list-based fashion. The Table View is created by the method Titanium.UI.createTableView.

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

append one or more rows to the table, optionally with animation

convertPointToView

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

deleteRow

delete an existing row, optionally with animation

deselectRow

programmatically deselect a row

fireEvent

Fires a synthesized event to any registered listeners.

hide

Hides this view.

insertRowAfter

insert a row before another row, optionally with animation

insertRowBefore

insert a row after another row, optionally with animation

remove

Removes a child view from this view's hierarchy.

removeEventListener

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

scrollToIndex

scroll to a specific row index and ensure that that row is on screen

scrollToTop

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

selectRow

programmatically select a row

setData

set the data in the table, optionally with animation

show

Makes this view visible.

toImage

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

updateRow

update an existing row, optionally with animation

Properties

Name Type Summary
allowsSelection Boolean

true if the rows can be selected

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.)

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.

data Array<Object>

the data array of objects to be used for the rows of the table view

editable Boolean

allow the table view to be editable (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

the filter attribute to be used when searching. this property maps to your data object or a property on the row object (Android, iPhone, iPad only.)

filterCaseInsensitive Boolean

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

focusable Boolean

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

footerTitle String

the table view footer title

footerView Object

the table view footer as a view that will be rendered instead of a label

headerTitle String

the table view header title

headerView Object

the 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<Object>

an array of objects (with title and index properties) to control the table view index (Android, 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

max row height for table view rows

minRowHeight Number

min 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

true (default) if tableview can be scrolled

search Object

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

searchHidden Boolean

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

separatorColor String

the separator color color as a hex or named value

separatorStyle Number

the separator style constant. For iPhone, Titanium.UI.iPhone.TableViewSeparatorStyle (iPhone, iPad, Mobile Web only.)

showVerticalScrollIndicator Boolean

whether tableview displays vertical scroll indicator (iPhone, iPad only.)

size Object

Size of the view as a dictionary of width and height properties.

softKeyboardOnFocus Number

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

style Number

the style of the table view. constant 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 Object

Transformation matrix to apply to the view. (Android, iPhone, iPad only.)

visible Boolean

Boolean value indicating whether the view is visible.

width Number or String

View's width, in platform-specific units.

zIndex Number

the z index position relative to other sibling views

Events

Name Summary
click

Fired when the device detects a click against the view.

dblclick

Fired when the device detects a double click against the view.

delete

fired when a table row is delete by the user

doubletap

Fired when the device detects a double tap against the view. (Android, iPhone, iPad only.)

longclick

fired when the device detects that a table view row has been clicked and held (i.e., pressed without lifting the finger or trackpad). (Android only.)

longpress

Fired when the device detects a long press. (Android, iPhone, iPad only.)

move

fired when a table row is moved by the user

pinch

Fired when the device detects a pinch gesture.

scroll

fired when the table view is scrolled

scrollEnd

fired when the table view stops scrolling

singletap

Fired when the device detects a single tap against the view.

swipe

Fired when the device detects a swipe gesture (left or right) against the view. (iPhone, iPad, Mobile Web only.)

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.

twofingertap

Fired when the device detects a two-finger tap against the view.