ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Controls, pages and windows / Table functions
  • Use conditions
  • Branch to collapse or expand
  • Managing the selection bar during collapse
  • Managing the selection bar during expansion
  • Runtime speed for the TreeView Table controls
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
Collapses or expands an element in a Table or TreeView Table control.
WINDEVWEBDEV - Server code TreeView Table control:
  • Collapses the branch if it is expanded. "Child" nodes are no longer visible in the TreeView Table control. Child nodes remain in their previous status (collapsed or expanded).
  • Expands the branch if it is collapsed. "Child" nodes are visible in the TreeView Table control.
Table control:
  • Collapses the break if it is expanded. The elements of the break are no longer visible in the Table control.
  • Expands the break if it is collapsed. The elements of the break are then visible in the Table control.
  • WINDEV collapses or expands the details of a row (For more details, see Managing the details of a row in a Table control):
    • Collapses the window if it is expanded.
    • Expands the window if it is collapsed.
Example
// Collapses or expands the selected branch in the TreeView Table control
SWITCH TableCollapseExpand(TVT_Schedule)
CASE taCollapse
Info(" Branch expanded. ")
CASE taExpand
Info(" Branch collapsed. ")
CASE taError
Info(" Branch not found. ")
END
// Expands or collapses the the first row of "TVT_Schedule"
TableCollapseExpand(TVT_Schedule, 1)
// Collapses or expands the specified branch in the TreeView Table control
TableCollapseExpand(TVT_Schedule, "MyRoot" + TAB + "MyBranch")
// Collapses or expands the break of the current row in "TABLE_Break"
TableCollapseExpand(TABLE_Break, TABLE_Break)
Syntax

TreeView Table: Collapsing or expanding a branch, specifying the row number Hide the details

<Result> = TableCollapseExpand(<TreeView Table control> [, <Row used>])
<Result>: Integer
State of the specified branch before calling the function:
taCollapseBranch collapsed.
taErrorBranch not found.
taExpandBranch expanded.
<TreeView Table control>: Control name
Name of the TreeView Table control to be used.
<Row used>: Optional integer
Number of the row containing the branch to collapse or expand. If this parameter is not specified, the branch contained in the current row is used.
WINDEVWEBDEV - Server code

TreeView Table: Collapsing or expanding a branch, specifying its name Hide the details

<Result> = TableCollapseExpand(<TreeView Table control> [, <Branch used>])
<Result>: Integer
State of the specified branch before calling the function:
taCollapseBranch collapsed.
taErrorBranch not found.
taExpandBranch expanded.
<TreeView Table control>: Control name
Name of the TreeView Table control to be used.
<Branch used>: Optional character string
Name of branch to collapse or expand. This parameter has the following format:
"<Root name>" + TAB + ["<Name of 1st node>" + TAB + ...
["<Name of 2nd node>" + TAB + [...]]]"<Branch name>"
A WLanguage error occurs if this parameter does not correspond to an existing branch.
If this parameter is not specified, the branch contained in the current row is used.
If two branches correspond to the specified path, only the first one is used.

Table with breaks: Collapsing or expanding a break Hide the details

<Result> = TableCollapseExpand(<Table control> [, <Row used> [, <Break>]])
<Result>: Integer
State of the specified break before calling the function:
taCollapseBranch collapsed.
taErrorBranch not found.
taExpandBranch expanded.
<Table control>: Control name
Name of the Table control to be used. This control must have one or more breaks. Otherwise, this function has no effect.
<Row used>: Optional integer
Number of row with break to collapse or expand. This number must correspond to the number of the current row or to the number of the first row with the break to expand or collapse. If this parameter is not specified, the break of the current row is used.
<Break>: Optional character string
Name of break to collapse or expand. This parameter must be specified in case of nested breaks. It allows you to define the break that will be collapsed or expanded. By default, no break is used if the breaks are nested.
WINDEV

Table and TreeView Table: collapsing a detailed window Hide the details

<Result> = TableCollapseExpand(<Table control> [, <Row used>])
<Result>: Integer
State of the specified details window before calling the function:
taCollapseBranch collapsed.
taErrorBranch not found.
taExpandBranch expanded.
<Table control>: Control name
Name of Table or TreeView Table control to use.
<Row used>: Optional integer
Number of row whose details must be collapsed or expanded. If this parameter is not specified, the details of the current row are used.
Remarks

Use conditions

TableCollapseExpand can be used on:
  • WINDEVWEBDEV - Server code a TreeView Table control.
  • a Table control based on a data file.
  • a Table control populated programmatically.
  • WEBDEV - Server code a Table control in "Server" or "Server + AJAX" mode.
  • WEBDEV - Browser code a Table control in "Browser" mode.
This function cannot be used on the Table controls based on a data file (direct access).

Branch to collapse or expand

TableCollapseExpand has no effect:
TreeView Table controlTable control with breaks
  • if the branch to use cannot be found.
  • if the branch to use is a leaf.
  • if the branch to use is already collapsed.
  • if the Table control contains no break.
  • if the Table control contains several breaks and the break to use is not specified.
  • if no row is selected in the Table control and if <Row number> is not specified.

Note for the TreeView Table controls:
  • If the parameter <Row used> or <Branch used> corresponds to the branch contained in the first row, the whole tree structure of the TreeView is collapsed (equivalent to TableCollapseAll) or expanded (equivalent to TableExpandAll).
  • When TableCollapseExpand is called, if the specified branch is expanded and has an associated procedure via the AddChildDelayed property, this procedure will be executed.

Managing the selection bar during collapse

For the TreeView Table controls:
  • If the selection bar was positioned on one of the elements of the node to collapse, it is positioned on the collapsed or expanded node after the call to TableCollapseExpand.
  • The modification code is called whenever the selection bar is moved. If two levels are collapsed and if the selection bar is positioned on the higher node, the modification codes of each level are run.
For the Table controls with breaks, the selection bar is not modified. It stays on the current element even if the break is collapsed.

Managing the selection bar during expansion

TableCollapseExpand does not change the position of the selection bar.

Runtime speed for the TreeView Table controls

The runtime speed of syntax 1 is faster than the runtime speed of syntax 2.
Component: wd290obj.dll
Minimum version required
  • Version 25
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/23/2022

Send a report | Local help