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

Awards for the best Joomla app. This product is gonna win an award for this amazing job. Cook Self Service is the the best application from all over the Joomla universe ! It brings Joomla to a professional level really advanced for developers. It is a real fun to develop with it. The ACL part and security checks implementation are just... so much hours saved. I can now concentrate myself more on the design part and the creative works. Thank you so much. Guys I offer you all my congratulation ! Keep up the works because Joomla is needing it to increase the quality of extensions availables on the JED. I also learned a lot because I can see how to code at the proper place and I found all my answers reading the forum.
lack_hanson (JED)
          

Get Started