Class Widget.TableView

TableView Widget.

a widget for scrolling items in a list.

Inherits from:
* Widget.ScrollView

Style Object:
* Style.TableView

Usage:

     dUI = require 'dmc_ui'
     widget = dUI.newTableView()

Properties

.delegate () set/get delegate for item.
.estimatedRowHeight () set/get the estimated height for each row.
.lowerOffset () set/get the lower offset for the TableView.
.scrollEnabled () set/get control TableView scrolling motion.
.upperOffset () set/get the upper offset for the TableView.

Methods

:getContentPosition () Returns the y coordinates of the TableView content.
:getRowAt (index) returns the reference to the row view located at index.
:insertRowAt (index) insert a new row in table.
:reloadData () reload data from data source.
:removeAllRows () remove all rows from the tableview.
:removeRowAt (index) remove existing row from table.
:scrollToRowAt (index[, params]) scrolls to row located at index.
:setContentPosition (params) Scroll to a specific y position.

Class Constants

Widget.TableView.EVENT TableView event constant.


Properties

.delegate ()
set/get delegate for item.

Usage:

  • widget.delegate = <delegate object>
  • print( widget.delegate )
.estimatedRowHeight ()
set/get the estimated height for each row.

Usage:

  • widget.estimatedRowHeight = 30
  • print( widget.estimatedRowHeight )
.lowerOffset ()
set/get the lower offset for the TableView. value must be a number, can be negative or positive. defaults to zero.

Usage:

  • widget.lowerOffset = 30
  • print( widget.lowerOffset )
.scrollEnabled ()
set/get control TableView scrolling motion. setting to false will disable scrolling in Y-axis.

Usage:

  • widget.scrollEnabled = true
  • print( widget.scrollEnabled )
.upperOffset ()
set/get the upper offset for the TableView. value must be a number, can be negative or positive. defaults to zero.

Usage:

  • widget.upperOffset = 30
  • print( widget.upperOffset )

Methods

:getContentPosition ()
Returns the y coordinates of the TableView content.

Returns:

    number y

Usage:

    local y = widget:getContentPosition()
:getRowAt (index)
returns the reference to the row view located at index. the row view or nil if not visible

Parameters:

  • index int row index at which to get row view

Returns:

    view or nil if the row is not visible/rendered
:insertRowAt (index)
insert a new row in table. row will be inserted at index given.

Parameters:

  • index int index at which to insert a row
:reloadData ()
reload data from data source. will rerender everything.
:removeAllRows ()
remove all rows from the tableview.

Usage:

    widget:removeAllRows()
:removeRowAt (index)
remove existing row from table. row at index will be removed.

Parameters:

  • index int index at which to remove row
:scrollToRowAt (index[, params])
scrolls to row located at index. use this when you want scrolling relative to a row and location in the TableView.

Parameters:

  • index int index for row to scroll to
  • params table of method parameters
    • position string The location reference for scroll action – 'none', 'top', 'middle', 'bottom'. (default 'none')
    • time int the duration for scroll animation, in milliseconds. set to 0 for immediate transition (default 500)
    • onComplete func a function to call when the animation is complete (optional)

Usage:

    widget:scrollToRowAt( 5, { position='top' } )
:setContentPosition (params)
Scroll to a specific y position. Moves content position to y over a certain time duration. Use this when you want to scroll to a specific Y location.

Parameters:

  • params table of parameters
    • y int the y position to scroll to
    • time int the duration for scroll animation, in milliseconds. set to 0 for immediate transition (default 500)
    • onComplete func a function to call when the animation is complete (optional)

Usage:

    widget:setContentPosition( { y=-35 } )

Class Constants

Widget.TableView.EVENT
TableView event constant. used when setting up event listeners

Usage:

    widget:addEventListener( widget.EVENT, listener )
generated by LDoc 1.4.3 Last updated 2015-05-14 11:55:05