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.