PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • Principle
  • Reminder
  • Implementation
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
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 "Disable the mechanism for page synchronization for this control" was not disabled in the description window of the control that runs the server code ("Advanced" tab).
Implementation
To customize the management of synchronization for the browsing Looper controls:
  1. Check whether the mechanism for synchronization management is enabled.
    • for the page ("Use the synchronization mechanism" in the "Details" tab of the page description).
    • for each button used to manage the looper or to perform an action on the record selected in the looper ("Disable the mechanism for page synchronization for this control" is unchecked in the "Advanced" tab of the control description).
  2. Create an invisible control in the looper.
  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 required version
  • Version 9
Comments
Click [Add] to post a comment