Official Content

Depending on the Automatic Refresh object property value, a grid control in the web form is automatically loaded when filters related with it are entered.

An "Automatic refresh" is done when any of these change:
-       Variables/Attributes/Properties which are part of both of the object and grid conditions.
-       Variables/Attributes which are input of the object's (or grid's) Load event.
-       Variables/Attributes/Properties assigned in the Start event and included in the grid (the purpose is not to lose its value upon refreshing the grid).

Automatic Refresh Property

The purpose of the Automatic Refresh property is to give the option of deciding whether to load the grid automatically or to have the end user enter the filters and press a "Refresh" button afterwards.

The possible values for this property are as follows:

  • When variables in conditions change (default value)
  • No

image4AutomaticRefresh

When variables in conditions change

As the user enters filters, the grid is automatically refreshed without the user having to click a "Refresh" button. 

This functionality is solved using Ajax, so only the necessary information travels from the server to the client (only the grid's filtered records).

Example 1

Suppose you have a grid which loads different products, and the following condition:

ProductDescription like &ProductDescription when not &ProductDescription.IsEmpty();

The variable &ProductDescription is in the form. When it's empty, no filters are applied, so all the records are shown:

image1AutomaticRefresh

As the user enters some key letters in the &ProductDescription filter, the grid automatically filters the corresponding records without the user having to click a "Refresh" button. The refresh is done automatically.

image2AutomaticRefresh

Note: Depending on the data type of the filter, and the web control used for the filter, the condition will be applied as it is being entered or when leaving the field. In the case of filters in edit controls, for character filters, they are applied as the user enters them. For date, datetime, and numeric fields, conditions are evaluated when leaving the field. In the case of filters in combo boxes, dynamic combos, conditions are evaluated when leaving the field. For Checkboxes and radio buttons, conditions are evauated when the value is changed. Note that only the grid refreshes, not the rest of the page, so if a checkbox is part of the filters, when checking, its start, refresh and load events won't be executed (because only the grid is refreshed by AJAX).
 

Example 2

Let's consider the same example as above, but in this case we add another filter, which is a dynamic combo box.

ProductDescription like &ProductDescription when not &ProductDescription.IsEmpty(); ProductCategoryId = &ProductCategoryId when not &ProductCategoryId.isempty();

As the &ProductDescription is being entered, the conditions are evaluated taking into account that there is another condition to be evaluated, so the records shown satisfy both conditions at the same time.

image3AutomaticRefresh

Automatic Refresh property = No

Example 3

In this case, the Automatic Refresh property is set to "No".

Users will have to click on the "Go" button in order to apply the filters they entered. The conditions will be evaluated as soon as that button is pressed. In this particular case, the button is associated to the "Refresh" event.

image5AutomaticRefresh

When does refresh take place if Automatic Refresh =No?

User action is needed to make the grid load the records that satisfy the conditions. Depending on whether the grid has a base table or not, there are two possible user actions to make the grid refresh after entering the filters:

  • Pressing Enter  (only if the grid has a base table)
  • Clicking on a button or image to trigger the search (in this case the grid may or may not have a base table).  

    See here for more information

Note

Refresh event is always executed on the server, be it automatic or not.

How to apply changes? Rebuild all objects


Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant