PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • Principle
  • Reminder: the synchronization code is triggered when the three following conditions are fulfilled
  • 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
Custom synchronization for the browsing Table controls
Overview
In some cases, you may want to use a custom synchronization for "Browsing Table" controls. For example, the synchronization must be managed between:
  • the page displayed in the browser. This page contains a "Browsing table" control.
  • the corresponding page context found on the server.
This custom management of the synchronization is used to update the page context on the server according to the page displayed in the browser. No out-of-sync message is displayed on the browser.
Principle
The custom synchronization method for "Browsing Table" controls relies on a piece of information hidden in the page: the identifier for the record selected in the Browsing Table control.
The synchronization consists in reading on the server the current record in the Browsing Table controls and in refreshing the control. These operations are performed in the synchronization code.

Reminder: the synchronization code is triggered when the three following conditions are fulfilled

  • the page displayed in the browser does no longer correspond to the page context on the server.
  • the user runs a server code by clicking a link or a button.
  • the option "Disable the mechanism for page synchronization for this control" was not disabled in the advanced tab of the control.
Implementation
To customize the management of synchronization for the browsing Table 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 Table control, or to perform an action on the record selected in the table ("Disable the mechanism for page synchronization for this control" is unchecked in the "Advanced" tab of the control description).
  2. Make sure that the "Send to server (Submit)" option is checked for the "Link" columns of your Table control. These columns are used to perform the click code on a row of the Table control.
  3. Create an invisible control (name "UNIKID" for example). This control must contain the identifier of the row selected in the Table control by the user. The initialization of this control must be performed:
    • in the initialization code of the Table control.
    • in the click code of a Table control row.
      Example of code used to initialize the control with the identifier of Customer: UNIKID = CUSTOMER.CUSTOMERID
  4. Create (if necessary) the buttons (or links) used to display the next or previous page of the Table control. The code of these buttons must initialize the invisible control created in step 3.
  5. Customize the synchronization code of the current page. This synchronization code must:
    • re-read the record corresponding to the identifier stored in the hidden control.
    • redisplay the Table control from this record
An example of synchronization code can be:
// Retrieve the value of the hidden control
CurrentRecord = PageParameter(UNIKID)

// Find the record
HReadSeek(CUSTOMER, CUSTOMERID, CurrentRecord)
IF HFound() = True THEN
// Modify the search key in case
// where the search key for the Table control is
// different from the value of the key stored in the invisible control
HChangeKey(CUSTOMER, Name)
// Refresh the Table control
TableDisplay(TABLE_MyTable, taRefresh)
// Retrieves the number of the current row
CurrentRow = PageParameter(TABLE_MyTable)
// Positions the bar in the Table control
TableSelectPlus(TABLE_MyTable, CurrentRow)
// 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