Skip to content

pbRestoreLayout - cCJGrid

Determines if the grid column layout should be saved and reloaded

Type: Property
Access: Read/Write
Data Type: Boolean
Parameters: None

Syntax

Property Boolean pbRestoreLayout
Access Type Syntax
Read Access: Get pbRestoreLayout to BooleanVariable
Write Access: Set pbRestoreLayout to BooleanVariable/Value

Description

pbRestoreLayout determines if the grid column layout should be saved when a grid is deactivated and restored when the application is run again. This includes column width, column order and column hiding. By default, this property is false.

For a layout to be saved and loaded, the following conditions must be met:

  1. pbRestoreLayout must be set true in the grid.
  2. pbPreserveEnvironment in the project's cApplication object must be set true.
  3. psLayoutSection must be assigned a unique string id.

By default, psLayoutSection has no value. If pbRestoreLayout is set true and you forget to assign a section name, an unhandled runtime error will be generated. This is provided to remind you to correct your code.

Set pbRestoreLayout to True
Set psLayoutSection to "ordervw_grid1"

Within a single run instance of an application, grid layouts are always restored. Any time a grid is activated, deactivated and then activated again the prior layout is always restored and this property has no effect on this behavior. pbRestoreLayout determines if the layout should be restored when the application is run again. Technically, it applies restoring on object creation, which for all practical purposes means running the application again.

All of the logic for saving and restoring grid layouts are handled by SaveEnvironment and LoadEnvironment.

Col 1 Col 2
Note: A number of the grid's column layout attributes are saved and restored. While it may be clear that attributes like column order and column width would be restored, other attributes, such as text and image alignment, are also saved and restored. Because of this, a code change in one of these columns may not be displayed in your grid as it will be using the layout previously saved. Therefore, when designing your grids it is best to disable layout saving and restoring by setting pbRestoreLayout to False or by setting the cApplication object's pbPreserveEnvironment property to false. Before deploying your application you can enable these properties and increment piLayoutBuild to ensure that your latest changes are shown.

See Also

psLayoutSection | pbPreserveEnvironment | piLayoutBuild | LoadEnvironment | SaveEnvironment | ExchangeLayout