Titanium.UI.TableViewRow

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

Summary

An individual row for a TableView.

Description

Use the Titanium.UI.createTableViewRow method to create a table view row.

A table view row represents a single item in a TableView. The row's contents can be as simple as a single line of text, or the row can be a completely customized with its own child views.

A basic table view row includes properties for setting:

  • Row title--the text displayed on the row.
  • Optional images on the left and right sides of the row.
  • Optional system decorations, such as checkboxes.

You can also set the usual view properties, such as background color and background image.

If you want a custom layout for your view, such as multiple lines of text, different fonts, or additional images or controls, you can add child views to the row. In this case, you should not specify a title for the row.

Make sure you set the className on each row instance if using more than one type of row layout. You can use the same value for each instance of a row where the layout is the same - even if the value of the elements inside the row have different values. For example, if the text is the only thing different between two cells but the layout is the same, both row instances should have the same value for className.

You can listen for table row events on all rows by adding an event listener to the table view instance. Events automatically propagate to parent views.

Platform Implementation Notes

The top, left and other positional parameters are not used for their usual purposes, because the table view row is automatically positioned by its parent.

On Android, these properties are used to position the content (title) inside the row. For example, setting top to 20 moves the title down from the top of the row. On iOS, these values have no effect.

On Mobile Web, these properties are used to relatively position the row, treating the TableView as if it were a horizontal layout.

Also, note that the selected text color, selectedColor, can only be set on iOS and Mobile Web. On Android, the text color does not change when the row is selected.

Code Examples

Simple Table View Row example

In this simple example, we create a table view row with a red square in the cell.

var row = Titanium.UI.createTableViewRow();
var view = Titanium.UI.createView({backgroundColor:'red',width:20,height:20});
row.height = 'auto';
row.add(view);

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.

convertPointToView

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

fireEvent

Fires a synthesized event to any registered listeners.

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.

getClassName

Gets the value of the className property.

getColor

Gets the value of the color property.

getEditable

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

getFocusable

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

getFont

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

getHasCheck

Gets the value of the hasCheck property.

getHasChild

Gets the value of the hasChild property.

getHasDetail

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

getHeight

Gets the value of the height property.

getIndentionLevel

Gets the value of the indentionLevel 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.

getLeftImage

Gets the value of the leftImage property.

getOpacity

Gets the value of the opacity property.

getRight

Gets the value of the right property.

getRightImage

Gets the value of the rightImage property.

getSelectedBackgroundColor

Gets the value of the selectedBackgroundColor property.

getSelectedBackgroundImage

Gets the value of the selectedBackgroundImage property.

getSelectedColor

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

getSelectionStyle

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

getSize

Gets the value of the size property.

getSoftKeyboardOnFocus

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

getTitle

Gets the value of the title property.

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.

remove

Removes a child view from this view's hierarchy.

removeEventListener

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

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.

setClassName

Sets the value of the className property.

setColor

Sets the value of the color property.

setEditable

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

setFocusable

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

setFont

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

setHasCheck

Sets the value of the hasCheck property.

setHasChild

Sets the value of the hasChild property.

setHasDetail

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

setHeight

Sets the value of the height property.

setIndentionLevel

Sets the value of the indentionLevel 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.

setLeftImage

Sets the value of the leftImage property.

setOpacity

Sets the value of the opacity property.

setRight

Sets the value of the right property.

setRightImage

Sets the value of the rightImage property.

setSelectedBackgroundColor

Sets the value of the selectedBackgroundColor property.

setSelectedBackgroundImage

Sets the value of the selectedBackgroundImage property.

setSelectedColor

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

setSelectionStyle

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

setSoftKeyboardOnFocus

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

setTitle

Sets the value of the title property.

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

Properties

Name Type Summary
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

className String

Class name for the row.

color String

Default text color of the row when not selected.

editable Boolean

Whether or not this row can be deleted when the table is in edit mode. (iPhone, iPad only.)

focusable Boolean

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

font Font

Font to use for the row title. (Android only.)

hasCheck Boolean

Render a system provided check mark in the right image area of the row.

hasChild Boolean

Render a system provided arrow in the right image area of the row.

hasDetail Boolean

Render a system provided detail disclosure button in the right image area of the row. (iPhone, iPad only.)

height Number or String

View height, in platform-specific units.

indentionLevel Number

Indention level for the row. (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.

leftImage String

Image to render in the left image area of the row, specified as a local path or URL.

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.

rightImage String

Image to render in the right image area of the row, specified as a local path or URL.

selectedBackgroundColor String

Background color to render when the row is selected.

selectedBackgroundImage String

Background image to render when the row is selected.

selectedColor String

Color of the row text when the row is selected. (iPhone, iPad only.)

selectionStyle Number

Selection style constant to control the selection color. (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.)

title String

Text to display on the row.

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 the device detects a click against the view.

dblclick

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

doubletap

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

longclick

Fired when the device detects a long click. (Android only.)

longpress

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

pinch

Fired when the device detects a pinch gesture. (iPhone, iPad only.)

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.