7. Paginated Controls
* The QDataGrid Variables
<< * Basic QDataGrid
|
Back to Main
|
* Adding Controls to QDataGrids >>
View Source
will open in a new window
The QDataGrid Variables -- $_ITEM, $_COLUMN, $_CONTROL and $_FORM
As you may have noticed in the first example, we make use of the $_ITEM variable when we render each row's column. There are in fact three special variables used by the QDataGrid:
$_ITEM
,
$_COLUMN
,
$_CONTROL
and
$_FORM
.
$_ITEM
represents a specific row's instance of the array of items you are iterating through. So in our example, the
DataSource
is an array of
Person
objects. Therefore,
$_ITEM
is the specific
Person
object for the row that we are rendering.
$_COLUMN
is the QDataGridColumn,
$_CONTROL
is the QDataGrid itself and
$_FORM
is the QForm itself.
So in our example, the first column shows the "Row Number", which is basically just the
CurrentRowIndex
property of the
QDataGrid
(e.g.
$_CONTROL
). And the last column's "Full Name" is rendered by the
DisplayFullName
method we have defined in our
ExampleForm
(e.g.
$_FORM
). Note that the
DisplayFullName
takes in a
Person
object. Subsequently, in our HTML defintion, we make the call to
$_FORM->DisplayFullName
passing in
$_ITEM
.
Finally, note that
DisplayFullName
is declared as a
Public
method. This is because
DisplayFullName
is actually called by the
QDataGrid
, which only has the rights to call
Public
methods in your
ExampleForm
class.
Row Number
First Name
Last Name
Full Name
1
kavita 2
arulyfred
arulyfred, kavita 2
2
Kendall2
Publics
Publics, Kendall2
3
Ben
5665564
5665564, Ben
4
Mike
Ho
Ho, Mike
5
Alex
Smith
Smith, Alex
6
Wendy
Smith
Smith, Wendy
7
Karen
Wolfe
Wolfe, Karen
8
Samantha
Jones
Jones, Samantha
9
Linda
Brady
Brady, Linda
10
Jennifer
Smithfgfg
Smithfgfg, Jennifer
11
Brett
Carlisle j
Carlisle j, Brett
12
Jacob
Pratt
Pratt, Jacob
13
sdf
sdf
sdf, sdf
14
sdhgfhsdg
jai
jai, sdhgfhsdg
15
billy
wilder
wilder, billy
16
Nice
Job
Job, Nice
17
good
job
job, good
18
moi
tpo77
tpo77, moi
19
test
test
test, test