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 manish tripathi tripathi, manish
2 Kendall ghjh Nix11 Nix11, Kendall ghjh
3 Ben Robinson Robinson, Ben
4 Miguel Ho Ho, Miguel
5 vadalmafa Smith 2asdf Smith 2asdf, vadalmafa
6 fghfghWendy Smith Smith, fghfghWendy
7 fgdfg Wolfe Wolfe, fgdfg
8 Samanthahg Jonesssssssss Jonesssssssss, Samanthahg
9 Linda Broy Broy, Linda
10 JenniferJ Smiths Smiths, JenniferJ
11 Brett Carlisl Carlisl, Brett
12 Jacob Pratt Pratt, Jacob
13 jj a a, jj
14 fernando valiente ! valiente !, fernando
15 a b b, a
16 John Forbes Forbes, John
17 234 edwe edwe, 234
18 Deni Sorotnik Sorotnik, Deni
19 jhjh jkj jkj, jhjh
20 tester 1234 1234, tester
21 Steve Jobs Jobs, Steve
22 Adam Sandler Sandler, Adam
23 Bill Gates Gates, Bill
24 sdf sdfs sdfs, sdf
25 alma korte korte, alma
26 nikos aliagas aliagas, nikos
27 sadf asdf asdf, sadf
28 34 34 34, 34
29 qq qqqqq qqqqq, qq
30 hello how r u how r u, hello