0

I've been doing a lot of research on the subject however I can't find anything about it.

I'd like to change the default title of an Employee table I created, however the scaffolding displays the id of the employee as a title.

example of a table title (see the red text label at the top):

example of a table title (see the red text label at the top)

Is there a way to change the default title of the table to a custom string such as Employees.first_name + Employees.last_name instead of just Employee.id somewhere in the Model configuration?

curious
  • 1,504
  • 5
  • 18
  • 32
Fred
  • 3
  • 4
  • **https://stackoverflow.com/questions/32999490/how-do-i-create-a-keyvalue-pair-display-field-by-combining-having-two-fields-i** – ndm Sep 16 '17 at 01:36
  • @ndm Thank you for the quick response, I discovered virtual and display fields just 5 minutes ago. However changing `$this->setVirtualField(string key)` in `EmployeesTable` does not seem to affect the scaffolding at all, as the `id` is still displaying. Is there something else I need to know? – Fred Sep 16 '17 at 01:43
  • Sorry, I've posted the wrong link: **https://stackoverflow.com/questions/38425881/how-to-use-a-custom-format-for-multi-column-display-fields** – ndm Sep 16 '17 at 01:50
  • @ndm The virtual field is working right now, however the display field does not seem to be changing anything in the scaffolding. I meant to say `$this->setDisplayField(string key)` in my previous comment. – Fred Sep 16 '17 at 01:56
  • Nevermind, it seems to be working properly in dropdown lists that reference to it. – Fred Sep 16 '17 at 02:07
  • I misread your question a little bit... you cannot practically change the ID there, as the primary key usage is hard coded in the generated template (`view.ctp`). You'll have to modify the template. – ndm Sep 16 '17 at 02:08
  • @ndm Makes sense, Thank you for the help! – Fred Sep 16 '17 at 02:13

0 Answers0