Documentation

InitSorting

InitSorting(
 mixed Path = false,
 string by_var = "by",
 string order_var = "order"
);

The method initializes sorting parameters stored in the session, if sorting wasn't specified directly. If sorting was specified beforehand, the function memories sorting parameters within session.

Note. The function operates with variables from global scope and it must be considered when creating component main files.

Function parameters

ParameterDescription Available from version
Path Page for which the sorting must be initialized. "False" means that sorting is required to be initialized for current page.
Optional. "False" by default.
by_var Name of the variable that passes sorting field ID.
Optional. Default value is "by".
order_var Name of variable that contains sorting direction: asc (by ascension) or desc (by descension). Optional. "Order" by default.4.0.6

See Also

Examples

<?
// if variables $by and $order are directly specified, their values are memorized within session
// otherwise they are initialized by values stored within session 
InitSorting();
$rsUsers = CUser::GetList($by, $order);
?>
<table>
    <tr> 
        <td>ID<br><?=SortingEx("s_id")?></td>
        <td>Login<br><?=SortingEx("s_name")?></td>
    </tr>
    ...
</table>


© «Bitrix24», 2001-2024
Up