scrollToRow( row )
This method scrolls the subfile grid in a Rich Display File to a specific row number.
Parameters:
row - specifies the row number to scroll the grid to; this will become the top row in the grid*.
Return Value:
Returns the RRN of the row just scrolled to.
Example:
getObj("Grid1").grid.scrollToRow(2);
*If the row parameter is high, then the bottom row will contain the last row of data. That happens when row is greater than recordCount - "number of rows", or if there is a header row, recordCount - "number of rows" - 1.
Note that this API is not meant to be used to link multiple grids' scrolling action together. For example, you should not use the scrollToRow() API on Grid1 that links to Grid2, and then use the API on Grid2 that links back to Grid1. The scrollToRow() API fires the 'onscroll' event, so trying to use this on multiple grids on one screen will result in an endless loop. This causes undesirable results when attempting to scroll your grid in your application. This API can be used to scroll multiple grids at one time, but should only be used in the 'onscroll' event of one grid. See the below image as an example:Â
Here, there are two separate grids on the screen. Notice that the grid on the left has no scrollbar. The grid on the right is placed inside of a simple container layout with the 'overflow x' property set to 'scroll' so that it can be scrolled left and right. To make the up/down scrollbar work for both of the grids at the same time, we used the scrollToRow() API in the right grid's 'onscroll' event:
getObj("leftGrid").grid.scrollToRow(row);
With "leftGrid" being the ID of the grid on the left side. This way, you can scroll both grids simultaneously using the up/down scrollbar on the right side.Â