PC SOFT

AYUDA EN LÍNEA
DE WINDEV, WEBDEV Y WINDEV MOBILE


  • Use conditions
  • Sorting a browsing Table or TreeView Table control
  • Managing a sorted Table or TreeView Table control
  • Sort on a calculated column
  • Table or Treeview Table control browsed by programming
  • Performing a sort according to the ASCII value
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Otros
Procedimientos almacenados
TableSort (Function)
 
Sorts a Table or TreeView Table control on one or more columns (lexicographical sort).
Note: When a control is sorted by TableSort, the images used to identify the sort direction are not displayed in the columns.
Versiones 16 y posteriores
Linux This function is now available for the WINDEV applications in Linux.
Nueva funcionalidad versión 16
Linux This function is now available for the WINDEV applications in Linux.
Linux This function is now available for the WINDEV applications in Linux.
Versiones 19 y posteriores
WEBDEV - Código Navegador This function is now available in Browser code for Table controls in browser mode.
Nueva funcionalidad versión 19
WEBDEV - Código Navegador This function is now available in Browser code for Table controls in browser mode.
WEBDEV - Código Navegador This function is now available in Browser code for Table controls in browser mode.
Versiones 20 y posteriores
Android This function is now available for Android applications.
iPhone/iPad This function is now available for iPhone/iPad applications.
Nueva funcionalidad versión 20
Android This function is now available for Android applications.
iPhone/iPad This function is now available for iPhone/iPad applications.
Android This function is now available for Android applications.
iPhone/iPad This function is now available for iPhone/iPad applications.
Ejemplo
// Sort the "Designation" and "Price" columns in the "TABLE_Product" control
// The "Designation" column is sorted in ascending order
// The "Price" column is sorted in descending order
TableSort(TABLE_Product, "Designation", "-Price")
// Multicolumn sort of Table control
// The "Designation" column is sorted in descending order
// The "Price" column is sorted in ascending order
TableSort("-Designation" + TAB + "+Price")
Sintaxis

Sorting a Table or TreeView Table control on one or more columns identified by their name Ocultar los detalles

<Result> = TableSort(<Table name> , <Name of column 1> [, ... [, <Name of column N>])
<Result>: Boolean
  • True if the sort was performed,
  • False otherwise.
<Table control>: Control name
Name of control to use. This control can correspond to:
  • a Table control.
  • a TreeView Table control.
If this parameter corresponds to an empty string (""), the control to which the current process belongs will be used.
<Name of column 1>: Character string with quotes
Name of first column to sort (up to 16 columns). This parameter has the following format:
"[<Direction>]<Column name>"

where:
  • <Direction> (character) indicates the sort direction:
    • "+": ascending sort (by default),
    • "-": descending sort.
  • <Column name> (character string): name of column to sort.
<Name of column N>: Optional character string with quotes
Name of Nth column to sort (up to 16 columns). This parameter has the following format:
"[<Direction>]<Column name>"

where:
  • <Direction> (character) indicates the sort direction:
    • "+": ascending sort (by default),
    • "-": descending sort.
  • <Column name> (character string): name of column to sort.

Sorting a Table or TreeView Table control according to a list of column names Ocultar los detalles

<Result> = TableSort(<List of columns>)
<Result>: Boolean
  • True if the sort was performed,
  • False otherwise.
<List of columns>: Character string
List of columns to sort (up to 16 columns). This parameter has the following format:
"[<Direction>]<Name of column1>" + TAB + "[<Direction>]<Name of column2>" + TAB + ...

where:
  • <Direction> (character) indicates the sort direction:
    • "+": ascending sort (by default),
    • "-": descending sort.
  • <Column name> (character string): name of column to sort. The name of a column is returned by TableEnumColumn. If two controls have identical column names, the name of the column must be prefixed by the name of the control ("+Table1.SortColumn"+TAB+"Table1.PriceColumn" for example).

Sorting a Table or TreeView Table control on the first ten visible columns of the control Ocultar los detalles

<Result> = TableSort(<Table control> [, <To sort>])
<Result>: Boolean
  • True if the sort on the first 10 control columns was performed,
  • False otherwise.
<Table control>: Control name
Name of control to use. This control can correspond to:
  • a Table control.
  • a TreeView Table control.
This parameter has the following format:
"[<Direction>]<Name of Table control>"

where:
  • <Direction> (character) indicates the sort direction:
    • "+": ascending sort (by default),
    • "-": descending sort.
  • <Name of Table control> (character string): name of Table or TreeView Table control whose first 10 columns will be sorted.
<To sort>: Optional boolean
  • True if the sort on the first 10 control columns must be performed,
  • False if the previous sort must be canceled. Once the sort is canceled, the order of control rows is not modified but the rows that will be added by TableAdd, TableAddLine, TableInsert or TableInsertLine will not be sorted.

Canceling a sort that was previously defined on a memory Table or TreeView Table control Ocultar los detalles

<Result> = TableSort(<Table control> , <False>)
<Result>: Boolean
  • True if the sort was canceled,
  • False if a problem occurred.
<Table control>: Control name
Name of control to use. This control can correspond to:
  • a memory Table control.
  • a memory TreeView Table control.
<False>: Constant
False: Keyword used to cancel a sort that was previously defined on a memory Table or TreeView Table control.
Observaciones

Use conditions

TableSort can be used on:
  • a memory or browsing control with automatic browse ("Automatic browse" option checked in the "Content" tab of control description). For a browsing control, the sort is performed on a single column.
  • a single-selection or multiselection control.
    WEBDEV - Código ServidorPHP Reminder: Multiselection controls are available in Ajax only WEBDEV - Código ServidorPHP Reminder: Multiselection is not available for Table controls in classic mode.
WEBDEV - Código ServidorPHP This function is available for Table controls in Ajax mode, Table controls in classic mode and TreeView Table controls.
WEBDEV - Código Navegador This function is available for Table controls in browser mode only.
WEBDEV - Código NavegadorAndroidiPhone/iPad The TreeView Table control is not available.

Sorting a browsing Table or TreeView Table control

A browsing Table or TreeView Table control will be sorted according to the first specified column (syntax 1 and 2). Caution: the column used for the sort must be linked to a key item in the data file used to browse the control.
Tip: To sort a browsing Table or TreeView Table control with several columns, use a composite key and ..BrowsedItem:
TableName..BrowsedItem = NAMECOMPOSITEKEY
To cancel a sort in a browsing Table or TreeView Table control, all you have to do is assign an empty string to ..BrowsedItem.

Managing a sorted Table or TreeView Table control

Reminder: TableSortedColumn returns the list of sorted columns.

Sort on a calculated column

TableSort should not be used on the calculated columns. Indeed, these columns are calculated when each row is displayed.
A sort performed by TableSort on a calculated column will be valid for the rows already displayed in the table.

Table or Treeview Table control browsed by programming

TableSort does not operate on a control browsed by programming.

Performing a sort according to the ASCII value

A memory zone allows you to perform a sort according to the ASCII value.
Example:
MemCrée("ZM")
MemAjoute("ZM", "abc", "abc")
MemAjoute("ZM", "ZZZ", "ZZZ")
MemAjoute("ZM", "zbc", "zbc")
MemAjoute("ZM", "ééébc", "ééébc")
MemAjoute("ZM", "AB", "AB")
MemAjoute("ZM", "CD", "CD")
MemAjoute("ZM", "çabc", "çabc")
MemAjoute("ZM", "bbc", "bbc")
MemTrie("ZM")
i est un entier
MemPremier("ZM")
TANTQUE PAS MemEnDehors("ZM")
i = MemEnCours("ZM")
Trace(MemRécupère("ZM", i)) // Affichage dans l'ordre ASCII
MemSuivant("ZM")
FIN
Componente : wd240obj.dll
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Exemplo TableSort
SWITCH COMBO_ordem
CASE 1
TableSort(TABLE_Cliente,"TABLE_Cliente.COL_ClienteID")
CASE 2
TableSort(TABLE_Cliente,"TABLE_Cliente.COL_Nome")
CASE 3
TableSort(TABLE_Cliente,"-TABLE_Cliente.COL_ClienteID")
CASE 4
TableSort(TABLE_Cliente,"-TABLE_Cliente.COL_Nome")
OTHER CASE
END
//Blog com Video e Exemplo
http://windevdesenvolvimento.blogspot.com.br/2016/02/curso-windev-tabela-010-tablesort.html
De matos AMARILDO
28 02 2016