Documentation

CAdminSorting

object
CAdminSorting(
   string $table_id[, 
   mixed $by_initial = false, 
   mixed $order_initial = false,
   string $by_name = "by",
   string $order_name = "order"]
)

This class can sort the rows in a table on a Control Panel page by clicking any column. You can configure the column sorting using CAdminList: AddHeaders.

Parameters

Parameter Description
table_id The table identifier.
by_inital The column identifier by which the default sorting is performed.
order_inital The default sort order ({'asc'|'desc'}).
by_name The name of a "GET" variable that will contain the identifier of a sorting column. Optional parameter. 'by' is the default value.
order_name The name of a "GET" variable that will contain the sort order. Optional parameter. The default name is 'order'.

The initialised class instance is passed to the CAdminList class constructor. Further preparation is accomplished automatically and does not require other actions on your side.

Example

 
$sTableID = "tbl_rubric"; // the table ID
$oSort = new CAdminSorting($sTableID, "ID", "desc"); // sorting object
$lAdmin = new CAdminList($sTableID, $oSort); // the main list object
© «Bitrix24», 2001-2024
Up