ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Page / Back button
  • Overview
  • Principle
  • Reminder
  • Implementation
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
The Looper control: Custom synchronization
Overview
How to manage the synchronization between:
  • the page displayed in the browser. This page contains a Looper control that displays the records found in a HFSQL file.
  • the corresponding page context found on the server.
Via a custom management of the synchronization, when an action is performed on a row in the page (click performed on a link to order a product for instance), the information stored on the server is updated according to the identifier found in the current row on the browser.
Principle
The method for custom synchronization of Looper controls is based on an information hidden in the page: the identifier of the selected row.
The synchronization consists in sending to the server the identifier of the current row on the browser.

Reminder

The synchronization code is triggered when the following conditions are fulfilled:
  • the page displayed in the browser does no longer correspond to the page context on the server.
  • the Web user runs a server code (by clicking a link, a button, an image, a menu option, ...). The option "Call the page synchronization process if the user pressed the browser Back button" has not been unchecked in the "Advanced" tab of the control description running the server code.
Implementation
To customize the management of synchronization for the browsing Looper controls:
  1. Check whether the mechanism for synchronization management is enabled.
    • at the page level ("Using the browser's "Back" button" corresponding to "Allowed (runs the synchronization code)" in the "UI" tab of the page description).
    • at each button to manage the looper or perform an action on the selected record in the looper ("Call the page synchronization process if the user pressed the browser Back button" unchecked in the "Advanced" tab of the control description).
  2. Create an invisible control in the Looper control.
  3. Define an attribute on the value of this invisible control (named "UNIKID" for example) in the description of the Looper control. This control must contain the identifier of the current row. The initialization of this control must be performed in the click code of the link or button found in the Looper control.
  4. Customize the synchronization code of the current page. This synchronization code must:
    • read the value of the hidden control for the current row.
    • re-read the record corresponding to the identifier stored in the hidden control.
    • perform the necessary processes according to the application.
An example of synchronization code can be:
Str is string
Key is string
Str = "_" + PageParameter(Looper1) + "_" + UNIKID
// Str = name of UNIKID control  in the current row
Key = PageParameter(Str)
// Key = content of UNIKID control in the current row
// Find the selected record
HReadSeek(PRODUCT, PRUNIKKEY, Key)
IF HFound() THEN
// Process to perform
...
// Continues the application without displaying a message
ChangeAction(caContinue)
ELSE
ChangeAction(caError)
END
Minimum version required
  • Version 9
Comments
Click [Add] to post a comment

Last update: 06/03/2022

Send a report | Local help