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

TOPIC:

Multiple Select Filters? 14 Oct 2013 20:03 #11391

I'd like to add a multiple select drop down filter to one of my list/grid views (it's being loaded from a foreign key), i.e. I'd like to subset the list using more than one foreign key value

Does anyone have an idea (just need a starting point) on how one could go about doing that?

Thanks!
Dave

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

Multiple Select Filters? 15 Nov 2013 21:57 #11635

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
Hi Dave,

JDom? I'm eventually going to be doing this for a product attributes filter in the next month or s as part of a shopping cart extension. I haven't given it any more thought other than my presumption to begin by looking at the JDom class responsible for populating the filters options & markup then extend it to allow multiple selection.

Some changes will need to be made to the sql query to accommodate how you would like it to behave: are the conditions to be chained by 'OR' / 'AND' operators for example... Anyway, let us know how it goes and if you need anything else. Hope it helps a little!

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The following user(s) said Thank You: dyoungers

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

Multiple Select Filters? 20 Nov 2013 15:36 #11688

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
You will need to write both in JDom and in the component model.

JDom can display the control, but its role is limited to this.

JDom :
Extends a normal combo to a multi-checkable list.
-> html.form.input.select.multi (new class)

Override only few things to make a control sending an ARRAY in post.

In Component list model:
(Write the maximum you can in the super class)

In this list model in general, receive this array and set the filter state var, this is already done automatically :
Change the filter type to 'array' in the list model constructor.(not tested, but should work)

Then in prepareQuery, create the SQL filter.
For this particular purpose, a super-function could be awesome. (Such as 'propagateAccesses' SQL creation)

Hope it helps.
Coding is now a piece of cake

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

Multiple Select Filters? 20 Nov 2013 15:40 #11689

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Also...

When you reload the page, the filter must be able to display the current selected values.
This should be done automatically, but I never tested it with arrays.

If somebody is trying all this I would really enjoy to have your reviews.

Thanks again Gez for your help.
Coding is now a piece of cake

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

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