Save State Property

Unofficial Content

Enables or disables state saving. When it is enabled, the grid state information such as pagination position, filtering and sorting will be saved in the Web Session. When the grid container page is reloaded, the grid state will be restored to the last known configuration. Applies to grids and free style grids.

The default value of this property is 'False' except in grids created by pattern work with that set it with 'True'.

 

Run-time/Design-time

This property applies only to design-time.

 

Grid State property

When Save State is 'True' the information about the state (such as pagination position, filtering and sorting) is stored in the Grid State property.

Grid State property can be accesed and modified in run-time. It is of type SDT GridState which is part of GeneXus Core module.

How to use State property?

When Save State is 'True' the grid screen state is implicitly loaded from State property at the end of Start Event which means that if you need to modify the state to be loaded it must be modified in Start event as the example below.

Event Start
  Grid1.State = GetGridStateFromBD(&pgmname, !”Grid1”)
EndEvent

In the same way, the grid screen state is implicitly stored to State property at the start of refresh Event. So if you want to save the state in another storage it must be done at Refresh Event.

Event Grid1.Refresh
   SaveGridStateOnDB(&pgmname, !”Grid1”, Grid1.State)
EndEvent