Sorting a QDataGrid by Columns
In this example we show how to make the datagrid sortable by individual columns.
For each column, we add the properties
OrderByClause and
ReverseOrderByClause (it is possible
to also just define
OrderByClause, and to leave
ReverseOrderByClause undefined). The
QQ Clause
you specify is given back to you when you call the
OrderByClause property on the
QDataGrid
itself.
So what you do is you specify the
QQ OrderBy Clause that you would want run
for each column. Then you pass the this clause to your class's
LoadAll or
LoadArrayArrayByXXX
method as one of the optional
QQ Clause parameters. Note that all Qcodo code generated
LoadAll and
LoadArrayByXXX
methods take in an optional
$objOptionalClauses parameter which conveniently uses the clause returned by the
QDataGrid's
OrderByClause method.
Convenient how they end up working together, isn't it? =)