⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Using set_relation



Brian Humes

Brian Humes
  • profile picture
  • Member

Posted 20 August 2012 - 20:13 PM

Obviously, I'm using set-relation incorrectly, but I can't figure out what I'm doing wrong.

I have two tables, products and categories.

Products table looks like this:
- id
- productName
- category_id

Categories table looks like this:
- id
- category_name

My function looks like this:


function products()
{
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->set_table('products');
$crud->set_subject('Store Products');
$crud->set_relation('category_id','categories','category_name');
$output = $this->grocery_crud->render();

$this->load->view('admin/crud',$output);
}


But when I load either the list or edit view, I am only seeing the category ID number. No dropdowns, etc.

Any help would be greatly appreciated! Thanks!

noskov.biz

noskov.biz
  • profile picture
  • Member

Posted 20 August 2012 - 20:27 PM

Hi, Brian Humes and welcome to the forum!
Try to change these lines:

$output = $this->grocery_crud->render();
$this->load->view('admin/crud',$output);


into these:

$output = $crud->render();
$this->_example_output($output);


P.S. Have you got any errors at the firebug?

Brian Humes

Brian Humes
  • profile picture
  • Member

Posted 21 August 2012 - 11:58 AM

That did it! Working perfectly now.

You, sir, are a gentleman and a scholar. Thank you for your assistance.

noskov.biz

noskov.biz
  • profile picture
  • Member

Posted 21 August 2012 - 13:47 PM

You are welcome ;)