Introduction

The latest How To topics are available in the K2 Five User Guide or the K2 Cloud User Guide’s How to section.

This Knowledge Base article describes how to use the Collapse and Expand View Events and Methods.

Audience
  • Developers
  • Form Designers
Required Knowledge
  • Views and Forms
  • Rules
  • Controls

The Collapse and Expand Events and Methods have been added to the Rule Designer when using a Rule on a Form. These Events and Methods can be used with Actions such as Transfer Data for example or to improve performance. The Load and Initialize methods can be used when expanding the View for example and don't have to be executed when the Form is Initialized. This minimizes the execution time when a Form is Initialized.

Implementation Details

The Collapse and Expand Events and Methods can be found when using a Rule on a Form:

Image

Fig.1 Collapse and Expand Events

Image

Fig.2 Collapse and Expand Methods 

Example Scenario

In the scenario below we will be using a Form with two Views. The Item View will be expanded and the List View will be collapsed. When the Create button is clicked on the Item View, we will expand the List View and perform the Initialize and List Refresh methods. This will minimize the execution time when the Form is Initialized.

Follow the steps below to set up the scenario:

  1. Create a SmartObject to be used in a View
  2. Auto generate an Item View and a List View from the Customer SmartObject.
  3. Auto generate a Form using the Item and List View.
  4. Edit the Form, navigate to the Layout screen and select the Customer List View
  5. In the Properties section under General, change the default to Collapsed
    Image
  6. Navigate to the Rules and edit the When the Form is Initialized Rule.
  7. Disable the following Actions:
    • Then on Customer List View, execute its Initialize method
    • Then on Customer List View, execute its List refresh method
    Image
  8. Click Finish to save the Rule
  9. Edit the On Customer Item View, when Create Button is Clicked Rule
  10. Add the following Execute a View method Actions: 
    • On Customer List View, execute its Expand method
    • On Customer List View, execute its Initialize method
    • On Customer List View, execute its List refresh method (This method is only necessary when default custom filters have been set up on the View)
    Image
  11. Click Finish to save the Rule
  12. Click Finish to save the Form
  13. Run the Form
  14. Complete information on the Item View, then click Create
  15. The List View is expanded, the View is initialized and the new information is displayed
    Image
    Image