ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Controls: Available types / Looper control
  • Overview
  • How to?
  • Configuring the control
  • "Add additional elements" event
  • Customizing the wait window or page
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
Overview
There are two methods to populate Table and Looper controls programmatically:
  • Populating the entire control: The entire data found in the control is loaded when initializing the control.
    Benefit: All the values are found in the control. You have the ability to perform searches or sorts on the elements found in the control.
    Drawback: The control and its data can use a lot of memory. For the mobile applications, the full load may consume bandwidth and slow down the display.
  • Populating the control if necessary (infinite Table and Looper): Only the data visible to the user is loaded in memory. The additional data is loaded on demand (when using the scrollbar for example).
    Benefit: Low memory usage. For the mobile applications, increased display speed and reduced bandwidth consumption.
    Drawback: No sorting or searching until all data is available.
How to?

Configuring the control

To enable the mechanism for filling the control if necessary (Infinite table/Infinite looper):
  1. Open the control description window.
  2. In the "Content" tab, in the "Infinite table"/"Infinite looper" section:
    • Check "Call the process for adding elements when the user scrolls to the end".
    • Select the internal window or page to be displayed when loading additional rows. You can:
      • Use the default internal wait window or page,
      • Use the preset window or page. If this option is selected, the WDAAF internal component is immediately added to the current project. Depending on the platform, the corresponding element (window or page) is automatically associated with the "Internal wait window" or "Internal wait page" option.
        • WINDEV In WINDEV, the internal window is named "IW_AddExtraElem_WD".
        • WINDEV Mobile In WINDEV Mobile, the internal window is named "IW_AddExtraElem_WM".
        • WEBDEV - Server code In WEBDEV, the page is named "IPAGE_AddExtraElem".
        Remark: If the WDAAF component already exists, only the window or page is added to the component.
      • Use an internal window or page from your project.
    • Specify the maximum number of rows: This number corresponds to the maximum number of rows that can be added to the control. Once this number is reached, the "Add additional elements" event will no longer be called.
  3. Validate the control description window.
By configuring the infinite Table or Looper control, you add:
  • WINDEVWINDEV Mobile In WINDEV and WINDEV Mobile: the "Add additional elements" event to the events of the control.
  • WEBDEV - Server code In WEBDEV: the following events to the events of the control:
    • Add additional elements (browser).
    • Add additional elements (server).
    • AJAX return after adding additional elements (browser).
Remark: This option is not available for:
  • Looper controls based on a data file, horizontal Looper controls and multi-column Looper controls.
  • the Table controls based on a data file.

"Add additional elements" event

The "Add additional elements" event must contain the code for refreshing data in the control. By default, the internal wait window is displayed while running this code. At the end of code execution, the internal wait window will be automatically hidden.
Remark: This event is automatically called:
  • when initializing the window, if the control is empty.
  • after the window initialization, if all the control rows are visible
  • once the control was enlarged, if all the control rows are visible (while they were not visible before the enlargement).
  • after a scroll to the bottom, if the last control row is visible.
Caution: If the default internal window is selected, a progress bar (wait window) is displayed while the "Add additional elements" event is executed. This progress bar will be displayed only if the main thread can be run while running the "Adding additional elements" event.
To see the progress bar, you must run a long refresh process (HTTP request or HFSQL iteration, for example) in a thread run from the "Add additional elements" event. In this case, the progress bar must be managed by TableAddInProgress and LooperAddInProgress.
Code example for the "Add additional elements" event: Filling a Table control with the last unread emails:
SessionID is int
EmailRead is Email
 
// Loads the last unread messages
EmailReadFirst(SessionID, EmailRead, emailUnread)
WHILE NOT Email.Out
// Process the message
TableAddLine(TABLE_Email, EmailRead.Sender, EmailRead.ReceiveDate, EmailRead.MessageID)
EmailReadNext(SessionID, EmailRead, emailUnread)
END
Remark: If the "Add additional elements" event returns False:
  • the internal wait window is not displayed anymore,
  • the "Add additional elements" event is no longer executed.
WEBDEV - Server code The same behavior applies.

Customizing the wait window or page

The progress bar is contained in an internal window or page.
WINDEVWINDEV Mobile A standard internal window is used by default, but you can integrate it into the project to customize it. The progress bar is automatically managed. The internal window used must contain a single infinite Progress Bar control.
WEBDEV - Server code A standard internal page is used by default, but you can integrate it into the project to customize it. The progress bar is automatically managed.
Minimum version required
  • Version 21
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/19/2023

Send a report | Local help