GotoPage Method

Official Content
This documentation is valid for:

Allows direct access to a specific group of registers when the automatic paging of grids and freestyle grids is used

Syntax

Grid.GotoPage(page-number)

Where:
Grid
    Grid control

page-number
    Is a numeric value

Values

0: Successful operation
1: The paging is not enabled in the grid. 

Description

This method can be only used if the grid has base table. The 'Rows' property must has a value different from 0.  Grids may be nested. 

This method efficiency is associated to the efficiency of the definition of the corresponding grid navigation.  I.e.: if the grid without paging has good response times, these times will be similar with paging.

Example

In this example, there is a grid (GSearchResults) with the result of a search and, another one (GPages) with the number of pages of the first one to allow a fast access paging.
 
Event Refresh
    &PageCounts = GSearchResults.PageCount
EndEvent  

Event GPages.Load
    if &PageCounts > 1
       &Count = 1
       Do while &Count <= &PageCounts
          &PageNumber = &Count
           SFPages.Load()
          &Count += 1
       EndDo
    EndIf
EndEvent  

Event &PageNumber.Click
    GSearchResults.GotoPage(&PageNumber)
EndEvent

Scope

Objects: Web Panels
Controls: Grids, Free Style Grids
Languages: .Net, Java, Ruby (up to GeneXus X Evolution 3)

See Also

FirstPage
NextPage
LastPage
PreviousPage Method
Rows property
Grid paging on the Web