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

TOPIC:

[SOLVED] Sortable by id 08 Oct 2011 17:57 #167

  • Kevin
  • Kevin's Avatar Topic Author
  • Visitor
  • Visitor
I see that cook automatically adds the id field in the table.

When in collection layout I cannot sort the items by the id.

Is there an option available.

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

Last edit: by admin.

Re: Sortable by id 10 Oct 2011 14:45 #178

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
The table is ordered by default on it's default field.

You can do this putting an ID column in the grid, and sort on it.
To instance the ID key of the table, just drag-drop the root of the fields tree.

OR

In your view, simply add :
$model->addOrder("a.id");

OR

In the model, change the default ordering key ('pre_order', or something like this, if I remember)




That's all.
Coding is now a piece of cake
The following user(s) said Thank You: Kevin

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

Re: Sortable by id 10 Oct 2011 16:13 #182

  • Kevin
  • Kevin's Avatar Topic Author
  • Visitor
  • Visitor
Excellent..... Got my id field now.

Thanks

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

  • Page:
  • 1
Time to create page: 0.180 seconds
  I still don't believe he can really be human to do all this ! From all of the forums that I've ever participated in this is certainly the one that most encapsulates the feeling of being truly open source where everyone's opinions and contributions can and will shape the development of the service! It's truly awesome! Hope you enjoy cooking and look forward to reading and contributing to any of the editorial work that you proposed too!! Thanks
Gez (audibleid - JED)

Get Started