ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / Developing an application or website / Controls, windows and pages / Controls: Available types / Table control
  • Default events
  • Optional events
  • Filter records (Table based on a data file only)
  • Before displaying the automatic tooltip of scrollbar
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Default events
WINDEVAndroidiPhone/iPadJava WINDEV and WINDEV Mobile use the following events by default (order of appearance in the code editor):
EventRuntime condition
InitializationExecuted when the window is opened. (*)

Special case: Table control based on a data file field filled in automatically.
When this code is run, the Table control is not filled yet. To force the Table control to be filled in this code, use:
You can also filter records with HFilter.
End of initializationCode only for automatically populated Table controls based on a data file:

Executed after the Table control has been populated. This code is used to select an element in the Table control, to add or modify an element.
Entry in the Table controlExecuted when the control gains focus.
Exit the Table controlExecuted when moving from one control to another (TAB key, selecting another control with the mouse, etc.).
Entry in input mode in a row of the Table controlExecuted when the user selects a row to perform an input in this row.
Exit a row of the Table controlExecuted when a line is changed or when a field is changed (TAB key, mouse field change, etc.) from a line. The Table control must be in edit.
In this code, the current row corresponds to the row that was selected beforehand.
Caution:
  • Table control with switch column switch: changing the switch alone does not execute the row exit code. If a user clicks a check box column, WINDEV does not consider this as entering the row in edit mode . The "Entry in input in a row" and "Exit a row" events are not executed. To manage this case, it is recommended to use the column modification code.
  • Table control in display: this code is not executed when a line is changed in a Table control in display.
Java In this code, the current row corresponds to the new selected row.
Displaying a row of the Table controlExecuted when a new line is to be displayed in the Table control: redisplay of the Table control, scrolling or moving in the Table control, etc.

This event is also run when column is assigned. If several columns are assigned through programming, the display code will be run several times.
Tip If you need to modify several columns, use the TableModifyLine function rather than direct assignment.
iPhone/iPad This event is not available in Table controls based on a data file for performance reasons.
Selecting a row of the Table controlExecuted when a user selects a row (without input).
This event is also executed when the user clicks on a cell in "Cell: Single selection" or "Cell: Multiple selection" selection mode.
AndroidiPhone/iPad Pull to refresh
This event is automatically added when the "Pull to refresh" feature is enabled ("Details" tab in the description window of the Table control).
This event is executed when a refresh gesture is detected on the Table control.
At the end of this event, the refresh bar will be automatically hidden except if TableRefreshVisible has been called.
WINDEViPhone/iPadJava Filter records (optional event)
Code only for automatically populated Table controls based on a data file:
Run just before displaying a row. This event filters the records displayed in the Table control. This event is detailed at the end of this page.
WINDEV Drag and Drop management events (optional events)
Code only for Table controls populated programmatically and Table controls based on a variable:
These events are used to simplify the management of programmed Drag and Drops. The available events are:
  • Start drag-and-drop operation.
  • End drag-and-drop operation.
  • Enter drop target.
  • Drag over drop target.
  • Drop on drop target.
  • Leave drop target.
Note If one of these events contains code, Drag and Drop is no longer automatically managed for the Table control: Drag and Drop in the Table control must be managed entirely programmatically.
Scrolling events (optional events)These events make it easy to manage the vertical scrollbar in the control. The available events are:
  • Scroll start: executed when the field's vertical scrollbar starts to scroll.
  • During dequeue: Executed when dequeueing the Scrollbar control's vertical scrollbar.
  • End of scroll: Executed at the end of the field's vertical scrollbar.
Note: The ScrollbarPosition function is used to find out the position of the elevator.

(*) By default, the "Initialization" event of each control is executed according to the order in which the controls were created in the window. To modify this runtime order:
  1. On the "Window" tab, in the "Order" group, click "Initialization".
  2. In the window that appears, use the arrows on the right to change the order in which the controls are initialized.
WEBDEV - Server codeWEBDEV - Browser codePHP The following events appear by default in the WEBDEV code editor:
EventRuntime condition
Initialization (Server code)Executed when the page is opened.
Special case: Table control based on a data file field filled automatically.:
When this code is run, the Table control is not filled yet. To force the control to be populated in this event, use:
You can also filter records with HFilter.
End of initialization (Server code)Code only for automatically populated Table controls based on a data file:
Executed after the Table control has been populated. This code is used to select an element in the Table control, to add or modify an element.
Row selection (Server code)Code run when the user selects a row in the Table control.
Row selection (Browser code)Table control in "Server + AJAX" mode
Executed when the user selects a row (without input).
Table control in "Browser" mode
Executed when the user selects a row (without input)
Row display (Server code)Executed when a new line is to be displayed in the Table control: redisplay of the Table control, scrolling or moving within the Table control, etc.
Used to manage the calculated columns.
Row display (Browser code)Table control in "Browser" mode only
Executed when a new line is to be displayed in the Table control: redisplay of the Table control, scrolling or moving within the Table control, etc.
Table click (Browser code)Executed when the Web user selects a row.
Exit a row (Server code)Table control in "Server + AJAX" mode only
Executed when a line is changed or when a field is changed (TAB key, mouse field change, etc.) from a line
Filter records (Server code)Code only for automatically populated Table controls based on a data file:
Run just before displaying a row. This event filters the records displayed in the Table control. This event is detailed at the end of this page.
Optional events
Several optional events can be added. To add an optional event:
  1. Select the desired control.
  2. Display the code window of this control (F2 key).
  3. Click the link "Add other events to xxx" at the bottom of the window code, after the last event.
  4. All the optional events available for the control are displayed.
  5. Check the optional event to add and validate.
    Note: Several optional events can be selected.
  6. The selected optional event is automatically added to the events managed by the control.
To disable an optional event, simply perform the same operations to display the list of optional events. Then simply uncheck the optional events to delete.
Note: If the deactivated code contains WLanguage code, this code is automatically deleted..
For example, you can use the following events:
  • the mouse hover over the control,
  • left mouse button down, up, double click,
  • right mouse button down, up, double click,
  • the mouse wheel, etc.
Remark: Depending on the environment (WINDEV, WEBDEV, WINDEV Mobile) and the development platform, the optional events available are not the same.
Filter records (Table based on a data file only)
WINDEVWEBDEV - Server codePHP The "Filter records" event is executed after a row of the Table control is displayed. Therefore, it is run:
  • when initializing the Table control.
  • whenever a row is displayed in the Table control.
This event filters the records displayed in the Table control.
To implement a filter, the "Filter records" event must return a value:
  • True to specify that the record matches to the filter and that it must be displayed.
  • False to specify that the record does not match the filter and that it must not be displayed.
  • Cancel to stop reading the data source of the table (very rare case).
Example:
// -- Filter the records
// Displays the customers who placed orders exceeding 3000 Euros
IF Orders.TotalIOT >=3000 THEN 
	RETURN True
ELSE
	RETURN False
END
In this code, the data used affects the record currently read by the Table control. This data comes from the data file or query linked to the Table control.
WINDEVWINDEV Mobile If an automatic filter is applied on the Table control (TableEnableFilter or filter enabled by the user directly), the filter defined by the "Filter records" event is combined with the automatic filter.
Note: In WINDEV and WINDEV Mobile, the "Record filtering" event is optional.. In WEBDEV, this event is proposed by default.
Before displaying the automatic tooltip of scrollbar
WINDEV In Windows, the tooltip for the scrollbar in a Table control is displayed when the user clicks the "box" of the vertical scrollbar.
This tooltip contains the following information by default:
  • Range of rows currently displayed in the Table control.
  • Total number of rows in the Table control.
  • Information about the element currently displayed in the first row of the Table control in the sorted column.
The event "Before displaying the automatic tooltip of the scrollbar" is run just before the tooltip is displayed. This allows displaying a specific text in the tooltip using the ToolTip property, for example.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 01/16/2025

Send a report | Local help