⚠ 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

Bugs in Displaying setRelation Field when Showing More Than One Field in v.2.6.10



larasmith

larasmith
  • profile picture
  • Member

Posted 09 January 2019 - 03:01 AM

Hello Sir Johnny!

 

Happy New Year! I just went back to programming and applied the version: 2.6.10. I have the following setRelation code:

$crud->setRelation('vdr_Course', 'set_course', '{course_Title} [{course_RefNo}]');

I noticed that the data displayed in the datagrid was the actual field and not the combined field just like the one displayed in the dropdown as I was trying to showing more than one field. Please refer to the image below:

set-Relation-display.png

 

Is this a bug? If so, I hope this gets fixed immediately. The users may get confused if this is not fixed.


larasmith

larasmith
  • profile picture
  • Member

Posted 12 January 2019 - 16:47 PM

Follow-up regarding this topic...

NadimD

NadimD
  • profile picture
  • Member

Posted 12 January 2019 - 21:44 PM

Hello larasmith,

 

I'm new here and can't answer for the staff, I'm not a pro, but I'm willing to help you.

 

You could try to follow what I did here in 2.6.11 :

=> /topic/136667-entreprise-issue-found-with-setrelation-and-bracets-solution-found/

 

Your problem might not be the same, so non-related, but since it's about brackets and fields, I think why not, you can always go back!

Also, could you try removing the brackets, just to see what happens, like this :

$crud->setRelation('vdr_Course', 'set_course', '{course_Title} {course_RefNo}');

Try again and leave only {course_RefNo}

 

Does that affect the display ? Is yes, you can try to use a callback, but you have to have the related field identifiable in order to make a callback on it:

https://www.grocerycrud.com/enterprise/api-and-function-list/callbackColumn

 

Set a callback on your column, get both course_Title and course_RefNo in your callback. Use the example provided in the link !