object:scrollToY()

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

Overview

Makes a TableViewWidget scroll to a specific y position. Note that the current y position can be retrieved with object:getContentPosition().

Syntax

object:scrollToY( options )

This function requires a single argument, options, which is a table that accepts the following parameters:

y (required)

Number. The y position to scroll to.

time (optional)

Number. Time in milliseconds to scroll to the specified position. 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 the table view to -300
tableView:scrollToY( { y=-300, time=600, onComplete=scrollComplete } )