Simplest way to do this probably is to:
- set realName field as title field (quite logical) in User model
- and simply use that title field in Lister (should be automatically)
So, in User Model you'll have to add:
public $title_field = 'realName';
And in Lister probably $lister->setModel($user_model)
should be enough.
Edit:
If you want to add field from related model (let's say e-mail) in your grid, then you can use leftJoin in your Post model, like this (not tested):
class Model_Post extends SQL_Model{
function init(){
parent::init();
// ... define your fields
// add left join to related TABLE (not model)
$join_users = $this->leftJoin('user', 'author_id');
// add field from joined table (not model)
$join_users->addField('email'); // it's not $this->addField(), but $join->addField() !!!
}
}
This will create field email in your Post model and it'll be filled with value from related table.