object:scrollToIndex()

Type Function
Library widget.*
Revision Release 2024.3703
Keywords table view, list view, TableViewWidget, scrollToIndex
See also object:scrollToY()
widget.newTableView()
TableViewWidget

Overview

Makes a TableViewWidget scroll to a specific row.

Syntax

object:scrollToIndex( rowIndex, time, onComplete )
rowIndex (required)

Number. The row index to scroll to.

time (optional)

Number. Time in milliseconds to scroll to the specified row index. For an instantaneous effect (no transition), set this to 0. Default is 400.

onComplete (optional)

Function. An optional function that will be called when the scroll completes.

Example

local function scrollComplete()
    print( "Scroll complete!" )
end

-- Scroll to row #20
tableView:scrollToIndex( 20, 800, scrollComplete )