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

Although I found this tool some time ago I just started learning experimenting and building this first component on Monday and now on Thursday afternoon it's already online. Although I already had a working version done with another tool this is much easier to build and at the end you have the freedom to own your own component. Once you know how to use Cook you will boost your productivity as the learning curve is really moderate compared to many other tools.
Giori (Forum)

Get Started