How to display two columns in a has_many relationship multifield ?
Hello,
i try to display two columns in a supercomboselect : only the first column after id in the table is visible ?
i.e. i try to display first_name and name of guests in my simple module 'events'.
thks for an idea or a clue.
Comments
i found : i ve override options_list function in my foreign table model :
public function options_list($key = NULL, $val = NULL, $where = array(), $order = TRUE)
{
$this->db->order_by($this->table_name . '.name', 'asc');
$this->db->select($this->table_name . '.id,' . $this->table_name . '.name,' . $this->table_name . '.first_name', FALSE);
if (!empty($where)) {
$this->db->where($where);
}
$query = $this->db->get($this->table_name);
if (!empty($query)) {
$results = $query->result_assoc_array('id');
$returns = array();
foreach ($results as $k => $val) {
$returns[$k] = $val['name'] . ' ' . $val['first_name'];
}
return $returns;
}
return FALSE;
}
everything seems to be ok.
have a nice day.