Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Ordering of foreign key data in drop downs 03 Dec 2015 16:36 #13719

  • Ferm
  • Ferm's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 39
  • Thank you received: 6
When I use a foreign key in a table, the records of the "foreign table" will be shown as drop downs in combo box filters in the list view and also in forms in the item view.

In both those situations, I can choose to use ajax loading or not. In my opinion, there are two problems:

1. The sorting is different. If I use the ordering wizard in the foreign table, the records will be shown as I order them with the ordering wizard only if I use ajax loading. If not, the records of the foreign table are always sorted alphabetically. So if my "foreign" table has the records A,B,C but he ordering is A,C,B, switching on ajax loading will give you A,C,B for the drop-down and without ajax it will be A,B,C
2. Small problem but in the item view, the design is different depending on whether I use ajax loading or not. For filters in the list view, it is always the same.

I would be really grateful if someone could help me figure out how to fix the ordering problem without using ajax loading. In my opinion, the problem is a rouge $this->addOrder() in the in the display function so it is possible to fork but you need to fork every view/layout combination.

Please Log in or Create an account to join the conversation.

Ordering of foreign key data in drop downs 07 Dec 2015 15:06 #13732

You can override the protected function prepareQuery(&$query) of the FK table.
Add an order there.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.048 seconds

  I am so so so looking forward to see how far this can go. Seems like the skies the limit at the moment.
Kevin (Forum) 

Get Started