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

View Source
will open in a new window
An Introduction to the QDataGrid Class
The QDataGrid control is used to present a collection of objects or data in a grid-based (e.g. <table>) format. All QDataGrid objects take in a DataSource, which can be an array of anything (or in our example, an array of Person objects).

In defining a QDataGrid, you must define a new QDataGridColumn for each column in your table. For each QDataGridColumn you can specify its name and how it should be rendered. The HTML definition in your QDataGridColumn will be rendered directly into your HTML output. Inside your HTML definition, you can also specify PHP commands, methods, function calls and/or variables which can be used to output item-specific data.

Calls to PHP can be made by using <?= and ?> tags (see this example's code for more information). Note that these PHP short tags are being used by Qcodo internally as delimiters on when the PHP engine should be used. QDataGrid (and Qcodo in general, for that matter) offers full support of PHP installations with php_short_tags set to off.

Finally, the QDataGrid's style is fully customizable, at both the column level and the row level. You can specify specific column style attributes (e.g. the last name should be in bold), and you can specify row attributes for all rows, just the header, and just alternating rows.
First Name Last Name
First Name is "joe" Doe
First Name is "Kendall" Public
First Name is "Ben" Robinson
First Name is "Mike" Ho
First Name is "Alex" 5456
First Name is "Wendy" Smith
First Name is "Karen" Wolfe
First Name is "Samantha" Jones
First Name is "Linda" Brady
First Name is "Jennifer" Smith
First Name is "Brett" Carlisle
First Name is "Jacob" Pratt
First Name is "Jane" Doe
First Name is "Hugh" Grant
First Name is "Tom" Williams
First Name is "45" 455
First Name is "Bob" Smith
First Name is "John" Doe
First Name is "hh" hh