Documentation

SortingEx

string
SortingEx(
 string by,
 mixed Path = false,
 string by_var = "by",
 string order_var = "order",
 string anchor = "nav_start"
);

The function returns HTML code used to display sorting direction visual cues. Usually, the function is used in a table header.

Function parameters

.
ParameterDescription
by Value which will be passed to the variable by_var. Usually, the sorting field ID is specified in this parameter.
Path A page URL (with all parameters) to which a link on a sorting direction arrow will be built.
Optional parameter. False by default which means that the current page is used.
by_var Name of a variable to receive a value of the by parameter.
Optional parameter. The default value is "by".
order_var The name of a variable containing the sorting direction: "asc" (ascending) or "desc" (descending). Optional parameter, by default equals to "order".
anchor An anchor to which a page will be scrolled in browser after setting the sorting. Optional parameter. By default equals to "nav_start".

See Also

Examples of use

<table>
    <tr> 
        <td>ID<br><?=SortingEx("s_id")?></td>
        <td>Header<br><?=SortingEx("s_name")?></td>
    </tr>
    <tr> 
        <td>1</td>
        <td>Element header</td>
    </tr>
</table>


© «Bitrix24», 2001-2024
Up