AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / Desarrollar una aplicación o un sitio web / Controles, ventanas y páginas / Página / Gestión del botón Atrás
  • Overview
  • Principle
  • Remember: the synchronization code is triggered when the following three conditions are met
  • Implementation
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Custom synchronization for Table controls based on a data file
Overview
In some cases, you may want to use a custom synchronization for Table controls based on a data file. For example, the synchronization must be managed between:
  • the page displayed in the browser. This page contains a Table control based on a data file.
  • 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 in the browser.
Principle
The custom synchronization method for "Table based on a data file" fields relies on information hidden in the page: the identifier of the record selected in the Table based on a data file field.
The synchronization consists in reading the current record in the Table control on the server and refreshing the control. These operations are performed in the synchronization code.

Remember: the synchronization code is triggered when the following three conditions are met

  • the page displayed in the browser no longer corresponds to the page context on the server.
  • the user runs a server code by clicking a link or a button.
  • "Llamar al proceso de sincronización de la página si el usuario hizo clic el botón Atrás del navegador" has not been unchecked in the "Advanced" tab of the control description.
Implementation
To customize the synchronization of Table controls based on a data file:
  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 Table control or perform an action on the record selected in the control (option "Llamar al proceso de sincronización de la página si el usuario hizo clic el botón Atrás del navegador" not unchecked in the "Advanced" tab of the control description).
  2. Make sure that the option "Enviar valor de los controles al servidor (HTML: submit)" is checked for the "Link" columns in your Table control ("Detail" tab of the column). 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.
      An example of code to initialize the field with the Customer ID is: IDUNIK = CLIENT.IDCLIENT
  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
Versión mínima requerida
  • Versión 9
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 30/09/2024

Señalar un error o enviar una sugerencia | Ayuda local