psLayoutSection - cCJGrid
Provides a unique string ID for saving and loading a grid's column layout. Must be provided by the developer.
Type: Property
Access: Read/Write
Data Type: String
Parameters: None
Syntax
Property String psLayoutSection
| Access Type | Syntax |
|---|---|
| Read Access: | Get psLayoutSection to StringVariable |
| Write Access: | Set psLayoutSection to StringVariable/Value |
Description
The psLayoutSection property contains a unique string ID for saving and loading a grid's column layout. By default, this is blank (although some wizards may assign a value for you) and a non-blank value must be provided by the developer.
For a layout to be saved and loaded, the following conditions must be met:
- pbRestoreLayout must be set true in the grid.
- pbPreserveEnvironment in the project's cApplication object must be set true
- psLayoutSection must be assigned a unique string id.
Set pbRestoreLayout to True
Set psLayoutSection to "ordervw_grid1"
The string ID must be unique within your application. The framework makes no attempt to auto-assign an ID as it was determined that any attempt to do that would create confusion when things went wrong (and they would go wrong). Therefore, it is up to you to create a naming scheme where each section name is unique within your application. A suggested approach would be to create an include file that contains the grid layout ID's for all grids in you application.
// File: GridLayoutId.pkg
Define C_CustomerSLGrid1 for "custSLGrid1"
Define C_OrderSLGrid1 for "orderSLGrid1"
Define C_OrderViewGrid1 for "orderviewGrid1"
:
You would then use these within the views.
Set pbRestoreLayout to True
Set psLayoutSection to C_OrderSLGrid1
While such an approach requires a little extra developer work up front, it creates an understandable and maintainable system, which should save you work in the long run.
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.
See Also
pbRestoreLayout | pbPreserveEnvironment | piLayoutBuild | LoadEnvironment | SaveEnvironment