⚠ 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

read page not showing relations



superdan
  • profile picture
  • Member

Posted 21 August 2013 - 08:04 AM

Hi there

 

here is my problem,

 

in my read page all the data are right, but i cant see relations as i see correctly in edit page.

 

For example,

in my edit page i see

relator: John

 

in my read page i see

relator: 2 ( 2 is the id of john in relators table ).

 

How can i see relations also in the read page?

Thanks a lot


davidoster
  • profile picture
  • Member

Posted 21 August 2013 - 10:48 AM

Please share your controller's function and the structure of the tables. Please also state the version of GC you use.


superdan
  • profile picture
  • Member

Posted 21 August 2013 - 11:19 AM

hi davidoster,

 

thank you for your reply

 

here is my controller

public function contatti()
        {
            //select table
            $this->grocery_crud->set_table('CONTATTI');
            
            //set subject
            $this->grocery_crud->set_subject('Contatti');
            
            //set relations
            $this->grocery_crud->set_relation('IDAZIENDE','AZIENDE','AC_RAGIONESOCIALE');
            $this->grocery_crud->set_relation('IDRUOLO','RUOLOCONTATTI','AC_RUOLO');

            //required fields ( mandatory )
            $this->grocery_crud->required_fields('AC_COGNOME','AC_NOME','IDUSER','BL_MASCHIO','AC_TELEFONO1');
            
            //ordering Fields
            $this->grocery_crud->fields('AC_COGNOME','AC_NOME','IDAZIENDE','IDRUOLO','AC_EMAIL','AC_TELEFONO1','AC_TELEFONO2','BL_MASCHIO','AC_NOTE');

            //columns to show
            $this->grocery_crud->columns('AC_COGNOME','AC_NOME','IDAZIENDE','IDRUOLO');
            
            
            //send output
            $output = $this->grocery_crud->render($this->variables);
            $this->_example_output($output);        
        }

but

 

IDRUOLO

and

IDAZIENDE

 

show correct only in the edit page with  AC_RUOLO AC_RAGIONESOCIALE

 

in the read page i see only the reference id

 

i use the last versione of GC


ollie10123
  • profile picture
  • Member

Posted 22 August 2013 - 00:56 AM

Hi,

 

I am also experiencing the same issue.

 

Controller:

public function model_management()
	{
			$crud = new grocery_CRUD();

			$crud->set_table('models');
			
			$crud->set_relation('sex','sex','gender');
			$crud->display_as('sex','Gender');
			
			$crud->set_relation('artist_type','artist_type','artist_type');
			$crud->display_as('artist_type','Model Type');
			
			$crud->set_relation('age_range','age_range','age_range');
			$crud->display_as('age_range','Age Range');
			
			$crud->set_relation('complexion','complexion','complexion');
			$crud->display_as('complexion','Complexion');
			
			$crud->set_relation('enthnicity','enthnicity','enthnicity');
			$crud->display_as('enthnicity','Enthnicity');
			
			$crud->set_relation('hair_color','hair_color','hair_color');
			$crud->display_as('hair_color','Hair Color');
			
			$crud->set_relation('hair_length','hair_length','hair_length');
			$crud->display_as('hair_length','Hair Length');
			
			$crud->set_relation('eye_color','eye_color','eye_color');
			$crud->display_as('eye_color','Eye Color');
			
			$crud->display_as('file_url','Profile Image');
			$crud->set_subject('Models');

			$crud->display_as('profile_image','Profile Image');

			$crud->set_field_upload('profile_image','assets/uploads/files');
			
			$crud->add_action('Gallery', '', 'images_examples/example3','ui-icon-image');

			$output = $crud->render();

			$this->_model_output($output);
	}

When i click edit, the relation is working as expected but the read view is only showing the ID.

 

I am also using the latest GC.

 

Thanks


superdan
  • profile picture
  • Member

Posted 22 August 2013 - 06:19 AM

Maybe a bug?

davidoster
  • profile picture
  • Member

Posted 22 August 2013 - 06:37 AM

[member=superdan], [member=ollie10123] can you share the structure of the tables?


superdan
  • profile picture
  • Member

Posted 22 August 2013 - 06:56 AM

Here it is in attachment,

 

thanks davidoster!

 

the public function is:

 

public function contatti()

and relations are:
           

  $this->grocery_crud->set_relation('IDAZIENDE','AZIENDE','AC_RAGIONESOCIALE');
  $this->grocery_crud->set_relation('IDRUOLO','RUOLOCONTATTI','AC_RUOLO');

 

In edit mode all works like a charm,

 

The problem exists in every table with relations  in my db ( i have 20 - 30 ).


superdan
  • profile picture
  • Member

Posted 22 August 2013 - 21:52 PM

im quite sure its a bug.

the problem seems to be in GC library

here

 

$field_info->crud_type = 'readonly'; #force readonly

 

when you set readonly relations disappear


davidoster
  • profile picture
  • Member

Posted 23 August 2013 - 08:50 AM

Hold on [member=superdan], on your function contatti()

there isn't anywhere anything about setting a field as read only!

Please post the code exactly as it is that generates problems!


superdan
  • profile picture
  • Member

Posted 23 August 2013 - 08:57 AM

hi davidoster,

 

 

the "read only" is NOT in my function contatti BUT is  in CG library and its called by default when any read page is opened!

 

 

$field_info->crud_type = 'readonly'; #force readonly ( IS IN GROCERY CRUD LIBRARY )

 

thats why im quite sure its a bug!


Prout
  • profile picture
  • Member

Posted 23 August 2013 - 14:52 PM

Hi,

 

Same here. It's showing relationship identifier, not the value. probably something to change in the library or a parameter? Am I missing something?

 

 


davidoster
  • profile picture
  • Member

Posted 23 August 2013 - 22:46 PM

Guys give me some time to research on this and I will get back to you.


superdan
  • profile picture
  • Member

Posted 25 August 2013 - 17:32 PM

Maybe it's better to transfer this 3d to bugs/issues.

davidoster
  • profile picture
  • Member

Posted 26 August 2013 - 12:00 PM

People this has being officialy submitted as an issue on ver. 1.4 and corrected.

Check here, https://github.com/scoumbourdis/grocery-crud/issues/231


superdan
  • profile picture
  • Member

Posted 26 August 2013 - 13:32 PM

YEP!
IT WORKS!

 

just still one minor ISSUE

 

in this way 

 

hidden fields are visible in read page but they MUST BE HIDDEN!

 

 

 

and also...

 

isnt possibile to personalize columns to show in read page and only in the read page ( i would like to hide some )?

 

 

grat job, thank you so much


web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 26 August 2013 - 15:48 PM

Hello [member='superdan'],

 

The problem with the hidden fields is now solved. Please check the latest files again at https://github.com/scoumbourdis/grocery-crud

 

.

 

Cheers

Johnny


superdan
  • profile picture
  • Member

Posted 27 August 2013 - 06:21 AM

Thank you so much!
Isn't there a change log?
Regards

davidoster
  • profile picture
  • Member

Posted 27 August 2013 - 06:30 AM

Thank you so much!
Isn't there a change log?
Regards

 

 

Be patience! It will come that also! ;)

John is extremely busy actually lately with his own projects and tries as hard as he can to support.


superdan
  • profile picture
  • Member

Posted 27 August 2013 - 06:34 AM

Ok don't worry. I know and appreciate so much his (but also your) job.
You are doing really a great work guys. Thanks a lot

superdan
  • profile picture
  • Member

Posted 27 August 2013 - 11:51 AM

sorry please delete this post