Foreign key name in table list.

Hi again, admin!

I have this problem:

I'v added public $foreign_keys = array('blog' => array(FUEL_FOLDER => 'blog_model'));
and i can select the foreign values, but when i look on the rows list i can see the value(foreign id), but no the displayed name.


Thank you for help <3


  • edited 5:03AM
    When you say "rows list" are you meaning the list view for the module or are you meaning the dropdown select for that field? If it's a foreign key, I'd include an "_id" on the field name to help denote it's a foreign key ID
  • edited 5:03AM
    No, i meant not the dropdown select. It works fine.

    When i select blog_id in dropdown select i expect to see the name of the blog in list (screenshot), but i see only id value (1,2,3) etc.

    I'v tried blog_id, but it doesnt work for me :(
  • edited 5:03AM
    That looks like you'll need to modify the model's list_items method and include a join on the blog table:
    public function list_items($limit = NULL, $offset = NULL, $col = 'id', $order = 'asc', $just_count = FALSE) { $this->db->join('blog', '' = 'mytable.blog_id', 'left'); $this->db->select('id,'); $data = parent::list_items($limit, $offset, $col, $order, $just_count); return $data; }
Sign In or Register to comment.