7. Paginated Controls
* The QDataGrid Variables
<< * Basic QDataGrid   |   Back to Main   |   * QDataGrid Sorting >>

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 P.A.M.ELA Dirac Dirac, P.A.M.ELA
2 Kendalll Jenner Jenner, Kendalll
3 Ben Robinson Robinson, Ben
4 Mike Ho Ho, Mike
5 Alejnadro Smith Smith, Alejnadro
6 Wendy jose jose, Wendy
7 Karen Wolfe Wolfe, Karen
8 Samantha prueba prueba, Samantha
9 Linda Brady Brady, Linda
10 Jennifer Smith Smith, Jennifer
11 Brett Smiths Smiths, Brett
12 Jacob Pratt Pratt, Jacob
13 wdt t t, wdt
14 w w w, w
15 w wwwgggggggg wwwgggggggg, w
16 asd asd asd, asd
17 sdfsdf sdfsdfsdf sdfsdfsdf, sdfsdf
18 kalle kula kula, kalle
19 df df df, df