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.