Recordset object contains records returned by the system.

Methods:

getSize() - returns number of records in recordset

Iterating through the recordset

The easiest way to work with the recordset is to iterate through it. If you use foreach statement, you'll get every record as an object.

You can use get($columnName) method to retrieve value of the column.

Example of iterating through recordset:

// get recordset from the grid
$recordset = $grid->getRecordset();

// iterate through the records
foreach($recordset as $rec) {
  echo 'Affiliate name: '.$rec->get('firstname').' '.$rec->get('lastname').'<br>';
}


Getting the list of columns

It is easy to get the list of all column names of the recordset.

foreach($recordset->getHeader()->toArray() as $column) {
  echo 'Column '.$column.'<br>';
}