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.057 seconds

This Component Generator is the REAL component generator. This tool is very easy to use and in a matter of minutes I was building a fully working extension. I was amazed with the end result... worth every cent...
Griiettner (JED)

         

Get Started