7. Paginated Controls
* QDataGrid Sorting
<< * Making entire QDataGrid rows clickable
|
Back to Main
|
* QDataGrid Pagination >>
View Source
will open in a new window
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
LoadArrayByXXX
method as one of the optional
QQ Clause
parameters. Note that all QCubed 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? =)
Person ID
First Name
Last Name
3
Ben
5665564
1
kavita 2
arulyfred
9
Linda
Brady
11
Brett
Carlisle j
4
Mike
Ho
14
sdhgfhsdg
jai
17
good
job
16
Nice
Job
8
Samantha
Jones
12
Jacob
Pratt
2
Kendall2
Publics
13
sdf
sdf
6
Wendy
Smith
5
Alex
Smith
10
Jennifer
Smithfgfg
27
test
test
22
moi
tpo77
15
billy
wilder
7
Karen
Wolfe