// check if there is a next page
if($this->getSadoPagination()->getNextPage() > 0)
{
// display link for next page
$this->html_foot .= '<a href="?' . $this->getSadoPagination()->getNextPageString()
. '">Next Page</a>';
}
}
}
[...]Another important part of the grid object is filters. Filters can be used to modify (or filter) data in the grid cells. Say, for example, you want to add a link to each user, with the user ID, where the user name is displayed. This can be done using a filter: class UserGrid extends SadoGrid
{
// initialize the grid
public function __construct()
{
// add instance of ORM class
$this->model(new User);

// add filter here as method
protected function nameFilter()
{
// now we can get data for the current row using $this->x syntax
// this would build a link with the user's name to the show_users page and send the user ID
return '<a href="show_user.php?id=' . $this->user_id . '">' . $this->fullname . '</a>';
}
}

Customize Query

The default query will simply pull all records from the current model/table (if the model/table is set). You can customize the WHERE and ORDER BY clause of a query like this: [...]
class UserGrid extends SadoGrid
{
// initialize the grid
public function __construct()
{
// add instance of ORM class
$this->model(new User);