The Refresh event is a system event that is followed by the Load event.
When the user presses the Refresh button in a Web Panel object, the Refresh event is executed.
In addition, executing the Refresh command (X Evolution 1 & 2)? written in an event also triggers the Refresh event (both in Web and in Smart Devices)
Web: It is executed for each Get or Post.
Smart Devices: It is not executed when a client event triggers.
Is the code that will be executed when the event is triggered. No grid attributes are available. In Web, plain-part attributes are not available either (because they have not been navigated yet: they are in Load event). In Smart Devices, they do, because the fixed part has its own base table, as opposed to what occurs in the case of a Web Panel.
This web panel allows the selection of a country (of all the countries stored) and the chosen country identifier shall remain in the &CountryId variable presented with the Dynamic Combo Box control (having set the properties associated with said control).
There is 1 defined condition, as shown in the image, for all the trips registered for the country chosen in the variable &CountryId to be loaded in the grid.
Within the grid in the last column there is an image-like variable, to which we will assign an image with the peso sign ($), in the start event.
Under the grid, we would like to see the prices of all the trips shown (in the &total variable).
Ok. What happens when we invoke the web panel from the browser for the first time? What is known as making a GET.
The client asks the server to run the program associated with the web panel and send back as a result a html file indicating the browser how to draw the screen (with which data, format, etc.). But, what does the program run in the server to create this html file?
First, the Start event. And because of what we have defined in it, the money symbol image is loaded in the &NewPriceImage variable.
Second, the Refresh event will be run once, causing the query to the TRIPS base table and its extended table to be run.
And immediately after, the Load event will be run for each registry browsed with the defined filter, and its data will be added as a line for the grid, in the html that will be sent to the client.
It is important to clearly understand that in this 1st running of the web panel (GET), the user has no time to choose any value in the Dynamic Combo Box. It is the 1st call to the object. So, the &CountryId variable will be empty… and the condition defined contemplates that filtering is only possible if the &CountryId variable is not empty (when not &CountryId.IsEmpty();). Therefore, the filtering will not take place and the page will be displayed with the grid loaded with all the trips of all countries.
It is noted that in the Refresh event, we have initialized the &Total=0 variable (because if we do not initialize that variable now, when the user changes the country selection in the Dynamic Combo Box and the query is performed again, with Load events running N times, the sum of all costs will continue to accumulate, without reinitializing).
Web Panels events
Refresh Grid event
Automatic Grid Refresh
Smart Device Events
Server-side Events in Smart Devices
Event Triggering Order in Smart Devices
Programming a Web Panel’s Refresh Event
Eventos en Web Panels (Spanish only)
Events in Smart Devices