ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Controls, pages and windows / Table functions
  • Use conditions
  • Multi-selection Table control
  • Horizontal Table control
  • Handling errors
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Moves a row or swaps two rows in a Table control. To move the columns in a Table control, use TableMoveColumn.
Example
// Echange la ligne en cours et la ligne 5
TableMoveLine(TABLE_Table1, rowSelected, 5, amSwap)
// Déplace la ligne en cours à la ligne 3
TableMoveLine(TABLE_Table1, rowSelected, 3, amMove)
// Echange la ligne en cours avec la ligne suivante
TableMoveLine(TABLE_Table1, rowSelected, amNext, amSwap)
Syntax

Moving a row to a specific position or swapping two specific rows Hide the details

<Result> = TableMoveLine(<Table control> , <Index of row to move> , <Destination row index> [, <Operation to perform>])
<Result>: Integer
New index of the row that was moved.
<Table control>: Control name
Name of the Table control to be used.
If this parameter is an empty string (""), the Table control of the current event will be used.
<Index of row to move>: Integer
Position of the row to move. This position must be between 1 and the number of rows in the Table control (returned by the TableCount function or the Count property, for example).
To move the row that is currently selected, use the rowSelected constant.
<Destination row index>: Integer
New row position. This position must be between 1 and the number of rows in the Table control (returned by the TableCount function or the Count property, for example). A fatal error occurs if this parameter is not valid.
To handle the row that is currently selected, use the rowSelected constant.
<Operation to perform>: Optional Integer constant (or combination of constants)
Change row position:
amDisplayDestinationThe moved (or swapped) row is displayed in the Table control. If necessary, the Table control is automatically scrolled to show the row at its new position. The selected row (selection bar) does not change.
This constant can be combined with the amMove and amSwap constants.
WEBDEV - Server codePHP Table in Ajax mode mode: the moved line will always be displayed at the top of the Table control.
amMove
(default value)
Moves the row to the index of the destination row.
amSwapSwaps the position of the source and destination row.
WINDEVWEBDEV - Server codeAndroidiPhone/iPadJavaUser code (UMC)PHPAjax

Moving or swapping two rows with respect to the current position Hide the details

<Result> = TableMoveLine(<Table control> , <Index of row to move> , <Relative move> [, <Operation to perform>])
<Result>: Integer
New index of the row that was moved.
<Table control>: Control name
Name of the Table control to be used.
If this parameter is an empty string (""), the Table control of the current event will be used.
<Index of row to move>: Integer
Position of the row to move. This position must be between 1 and the number of rows in the Table control (returned by the TableCount function or the Count property, for example).
To handle the row that is currently selected, use the rowSelected constant.
<Relative move>: Integer constant
Moves or swaps a row to a position relative to the index of that row.
amFirstMoves the row to the first position.
amLastMoves the row to the last position.
amNextMoves the row one position downwards.
amNextPageMoves the row one page to the bottom (a page corresponds to the number of rows that can be simultaneously displayed in the Table control).
amPreviousMoves the row one position upwards.
amPreviousPageMoves the row one page to the top (a page corresponds to the number of rows that can be simultaneously displayed in the Table control).

If this parameter is invalid (e.g., if the amPrevious constant is used on the first row of the Table control), the row is moved "to the nearest" position.
<Operation to perform>: Optional Integer constant (or combination of constants)
Change row position:
amDisplayDestinationThe modified row is displayed in the Table control. If necessary, the Table control is automatically scrolled to show the row at its new position. The selected row (selection bar) does not change.
This constant can be combined with the amMove and amSwap constants.
WEBDEV - Server codePHP Table in Ajax mode The modified line will always be displayed at the top of the Table control.
amMove
(default value)
Moves the row to the index of the destination row.
amSwapSwaps the position of the source and destination row.
Remarks

Use conditions

TableMoveLine can be used on:
  • a Table control populated programmatically.
  • a Table control with in-memory data source.
  • WINDEVReports and QueriesJavaUser code (UMC) a horizontal Table control.
  • WEBDEV - Server codePHP a Table control in "Server" or "Server + AJAX" mode.
  • WEBDEV - Browser code a Table control in "Browser" mode.
This function cannot be used on TreeView Table controls and on Table controls based on a data file (direct access).
Notes: Moving a line according to field type:

Multi-selection Table control

If TableMoveLine is used on a multi-selection Table control:
  • when moving a line (constant tdDéplace): only the first selected line is moved.
  • when exchanging lines (constant tdEchange): only the first line will be exchanged.
  • the rowSelected constant cannot be used. Otherwise, a fatal error occurs and no row is moved.
WINDEVReports and QueriesJavaUser code (UMC)

Horizontal Table control

If TableMoveLine is called on a horizontal Table control, columns will be moved instead of rows.
To move the rows in a horizontal Table control, use TableMoveColumn.

Handling errors

Caution: TableMoveLine returns no error code. To determine if this function has generated an error, use ErrorInfo with the errMessage constant.
WEBDEV - Browser code The ErrorInfo function is not available.
Component: wd300obj.dll
Minimum version required
  • Version 14
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help