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

TOPIC:

ordering of combo 07 Nov 2013 15:21 #11547

  • ewajoom
  • ewajoom's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 36
  • Thank you received: 2
Hi,

Is it possible to order combo lists a I want ? (it seems to be ordered by name, for one combo I want it ordered by ordering value)
? (I think it could be a good improvement to have an "order by" properties in builder)

thanks!

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

ordering of combo 11 Nov 2013 19:56 #11573

  • ewajoom
  • ewajoom's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 36
  • Thank you received: 2
More precisions : I would like to have only activ tems (where table.activ=1), and the list orderer by my own order ( order by ordering)...
Anybody knows where is the sql request for combos lists ?

Thanks...

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

ordering of combo 12 Nov 2013 11:44 #11575

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
In brief :

Solution A : Use the context state var.
In prepareQuery(), create a new context case, and call this context for your lists.

Lists are prepared in the view, so
1. find the model which prepare thoses items.
2. Just before getItems(), add
$model->setState('context', 'myContext');
3. Add your custom query in prepareQuery().
in the switch(), add a new case. Call it as your please.



Solution B :
Instance a regular filter directly in the view.

1. find the model which prepare thoses items. (same)
2. Just before getItems(), add
$model->setState('filter.ordering', 'a.activ = 1');

This is possible because ordering is already a possible filter.
If you want a special behaviour, so the use the solution A : Custom SQL Query.

In both cases A & B, the security ACL is always handled per default if you code it correctly.
Coding is now a piece of cake
The following user(s) said Thank You: ewajoom

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

ordering of combo 15 Nov 2013 05:59 #11613

  • ewajoom
  • ewajoom's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 36
  • Thank you received: 2
Thanks for your clear explanations.
I think that it could be a good improvement in the builder.

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

  • Page:
  • 1
Time to create page: 0.085 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