I have a table shown on a flexigrid that, via a set_relation, displays some extra fields from a related table,
e.g. $this->grocery_crud->set_relation('customers_id','customers','{lastname} {firstname}');
and I am building a single record view.
How can I access this cell value (probably via javascript right?) that holds the 'customers','{lastname} {firstname}'?
Get cell value from flexigrid
Started by davidoster, 12 October 2012 - 07:49 AM
- Single Page
Posted 12 October 2012 - 07:49 AM
Posted 19 October 2012 - 12:01 PM
I ended up building a new model where I pass the id, e.g. customers_id and I populate the data output array from the controller to the view!
Something like this...
[u][b]controller:[/b][/u]
$this->load->model('itemmodel');
$data['customer_name'] = $this->itemmodel->get_customer_flname_by_id('customers', $data['view']->customers_id)->row();
[u][b]model:[/b][/u]
public function get_customer_flname_by_id($table, $id)
{
$this->db->where('id', $id);
$this->db->select('fname, lname');
return $this->db->get($table);
}
[u][b]view:[/b][/u]
<tr>
<td valign=\"top\"><b>Customer's Name</b></td>
<td>" . '<a href="' . site_url('main/customer_row') . "/". $view->customers_id . '">' . $customer_name->fname . ' ' . $customer_name->lname . "</a>" . "</td>
</tr>
I hope this helps somebody!
Something like this...
[u][b]controller:[/b][/u]
$this->load->model('itemmodel');
$data['customer_name'] = $this->itemmodel->get_customer_flname_by_id('customers', $data['view']->customers_id)->row();
[u][b]model:[/b][/u]
public function get_customer_flname_by_id($table, $id)
{
$this->db->where('id', $id);
$this->db->select('fname, lname');
return $this->db->get($table);
}
[u][b]view:[/b][/u]
<tr>
<td valign=\"top\"><b>Customer's Name</b></td>
<td>" . '<a href="' . site_url('main/customer_row') . "/". $view->customers_id . '">' . $customer_name->fname . ' ' . $customer_name->lname . "</a>" . "</td>
</tr>
I hope this helps somebody!