⚠ 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

Issue - set relation 1_n does not work in list state, but it does in add state



ASuarez

ASuarez
  • profile picture
  • Member

Posted 31 March 2020 - 19:31 PM

Hi,

 

my set_relation seems to only work in the add state:

 

List:

[attachment=1403:list.png]

 

Add:

[attachment=1404:add.png]

 

This is something weird, isn't it? Here is my code for the function:

public function creatives() 
{
	$crud = new grocery_CRUD();
	$crud->set_table('creatives');
	$crud->set_subject('Creative');
	$crud->columns('cr_creativeConcat', 'cr_campaignConcat', 'cr_creativeName', 'cr_creativePartner', 'cr_creativeURL', 
                       'cr_creativeStatus', 'cr_creativeCreated', 'cr_creativeModified');
	$crud->where('cr_creativeOwner', $this->ion_auth->user()->row()->id);
	$crud->set_relation('cr_campaignConcat','campaigns','ca_campaignName');
		
		
	$output = $crud->render();
	$this->_example_output($output);
}

I believe it has something to do with my sql. My table design is as follow:

[attachment=1405:tables.png]

 

Can you provide some hints to see how I could solve that?

 

Thanks in advance!

 

Kind Regards,

Agustin


ASuarez

ASuarez
  • profile picture
  • Member

Posted 31 March 2020 - 21:46 PM

Ok, so I realized the problem was the key used in one of the tables