⚠ 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

change_field_type dont work if come from a relation



superdan
  • profile picture
  • Member

Posted 16 September 2013 - 12:14 PM

Hi all it seems ive found an issue:

 

this command in the controller

$this->grocery_crud->change_field_type('IDAGENTEREF','hidden');

dont work anymore ( in the sense that the field remains visibile in read, edit and add )

 

 

IF and only IF  IDAGENTEREF derives from a relation e.g.

$this->grocery_crud->set_relation('IDAGENTEREF','AGENTI','AC_COGNOME');

I use last 1.4

Thank you for your attention

 


davidoster
  • profile picture
  • Member

Posted 16 September 2013 - 13:09 PM

Download the latest 1.4.1.

 

Sorry, it's not resolved on version 1.4.1 either!

We need to wait!


Amit Shah
  • profile picture
  • Member

Posted 16 September 2013 - 14:55 PM

Well a very question i will like to understand as why you need to set it hidden .... and if u need to keep it hidden, why u setting the relation @first. If the only reason you have is that you need it visible while listing .. then check out on the state for the same by $crud->getState() ... and set the field type / relation for the set state. This .. when resolved will surely be available to all.. and till date - this customizing the state of the field based on the state of action is best running solution.

 

I also came across a harder situation on the same - where i wanted to display the name of customer in an edit form but need to keep it readonly / disabled. But in such a scenario - it shows up only customer id and not the name. So a better solution to the same that i will suggest is -  a callback function for the same.!!

 

Happy GCing.


superdan
  • profile picture
  • Member

Posted 16 September 2013 - 15:21 PM

Hi Amit

 

the reason is that these fields MUST be hidden for certain users BUT must be visibile for other users.

 

Thats why!


Amit Shah
  • profile picture
  • Member

Posted 16 September 2013 - 17:25 PM

I am not denying the reason for you to have it in the place. Your decision is also perfect on for the occasion. But that again is conditional .. and in the condition itself you can set it the way it is desired to. That's what had been the gist of the above statement. Rather then making it generic for every condition ... at this point of time will recommend keeping it variant for variable conditions.

 

Happy GCing :)


heruprambadi
  • profile picture
  • Member

Posted 17 September 2013 - 02:43 AM

yep.. it's a bug with new method change_field_type.

https://github.com/scoumbourdis/grocery-crud/issues/241