Skip to content

Class: cWebWidgetContainer

Properties | Events | Methods | Index of Classes

Component that houses cWebWidgets.

Hierarchy

Library: Web Application Class Library
Package: cWebWidgetContainer.pkg

Description

The cWebWidgetContainer is the component that will house your cWebWidgets. Instances of this class can be directly added to a view and facilitate features like drag & drop support, widget configuration, resizing, etc., out of the box.

Registering Widgets

Before instances of any cWebWidget class can be created, they must first be registered with the container. This lets the container know that a cWebWidget class (usually composite) exists with a certain name, and the container can use this class to create instances of this widget when encountering the name in certain instructions or a given configuration.

Registering widgets is done inside the OnRegisterWidgets event. See the documentation for this method for more information and sample usage.

Loading Configurations

Loading a configuration means instructing the container to create, position, and configure a set (0, 1, or more) of cWebWidgets by feeding it a data structure from which it can derive the necessary information. By default, configurations are loaded from the client browser's local storage, but by setting pbUseCustomConfigurationStorage to true, you'll be able to implement OnLoadConfiguration, where you can implement your own business logic to load a configuration. See the documentation for OnLoadConfiguration for more information and sample code.

Saving Configurations

Saving a configuration involves translating the current layout present at the client to a data structure and storing it somewhere so that it can be loaded again later. By default, configurations are saved to the client browser's local storage, but by setting pbUseCustomConfigurationStorage to true, you'll be able to implement OnSaveCustomConfiguration, where you can implement your own business logic to store the configuration somewhere. See the documentation for OnSaveCustomConfiguration for more information and sample code.

Default Configurations

Default configuration means introducing a configuration that will be loaded when no other configuration is present. This would happen when a user enters your application for the first time and hasn't yet stored their own configuration to the browser's local storage.

Creating a default configuration is easy. Simply create child objects inside the cWebWidgetContainer just like you would add objects to a view or any other container. Any object placed directly inside your container declaration will be used towards the default configuration. You can have multiple instances of the same cWebWidget class, with different (web) property assignments. As an added bonus, any cWebWidget that you add here through this manner will also automatically perform a RegisterWidget instruction, meaning that registering the widget inside OnRegisterWidgets is not mandatory in this scenario.