List filters count

Hello,

Would it be possible to show the number of results close to each filter value ?
For example, if I have a list filter called months that allows to filter my trips departures per month, I'd like to have checkboxes with :
January (2)
February (5)
March (1)

And also, I have seen that the list filter trigger with "onload" (see in list settings, first filter option) doesn't work with filter type "checkbox". Currently, checkbox filter type only works with submit button, but I'd like to have the list re-load with just a click in a checkbox

I know that these options are not currently part of Fabrik options, but I may consider paying custom developments if it's doable.

Thanks !
 
Well, the issue with checkbox filters is that by definition, more than one checkbox might be selectable. Like, "Select colors: red / blue / green / yellow". If the filter triggered on the first checkbox selection, you'd never be able to select multiple checboxes. And I think the logic which overrides the "onChange / button" choice is done somewhere in the view or model code, it's not done somewhere which can easily be customized in a way that wouldn't get overwritten when you updated Fabrik.

As for putting the "results" next to the checkboxes ... are you talking about "results", or do you mean "potential results". By which I mean, do you eant to take the current filter set in to account.

So, say, if you had other filters for (say) "Departure From", and a choice of (say) airports, and you were currently filtering on Denver and Detroit for the Departure From, would you want them "Trip Departures by Month" "results" to show only those from the two select airports?

Either way, this won't be entirely trivial, as by definition filters, well ... filter. In other words, when we do the main getData() query for the list, we filter it using a WHERE clause derived from your filter selections. So if you have selected "March", our main query would have "WHERE MONTH(departure_date) = 'March'" (or whatever). So ... that query only returns rows for March. So ... we have no clue how many rows there are for other months.

So in order to do this, would require some fairly extensive custom coding, probably in a custom template, to do a non-filtered query of the table, which sums the totals for the months and inserts those totals in the filter display.

Bottom line ... sure, anything is do-able ... but this would not be entirely trivial, and the first requirement (onchange filtering for checkbox) might require adding YAFO (Yet Another Option) to Fabrik itself, which we are kind of reluctant to do.

Off the top of my head, this would be at least a day's work.

-- hugh
 
Maybe you can use the "Group by" option.
Group by "month" will show the number of records in every group heading, if you set the list to start with collapsed groups you will get the list displayed as
January (2)
February (5)
March (1)
 
Thanks for your answers,

yet, when Hugh says :
If the filter triggered on the first checkbox selection, you'd never be able to select multiple checboxes
... I don't understand because (in my setup) when I select january in my months filter and hit the "Enter" button I have the following result :
- the page results (rows) are filtered
- the filter still shows all 12 months (with "january" selected)
...and I can now select february to show rows for january and february... which is what I'm looking for...
I know that the page needs to load each time a new month (checkbox) is selected, but if the page loads fast enough, that would still be interesting in some cases.
It seems to just being a matter of enabling onclick filtering for checkboxes... But I'll look for a form solution (3 main criterias in a form including months + dropdown filters below).


For the results count
So, say, if you had other filters for (say) "Departure From", and a choice of (say) airports, and you were currently filtering on Denver and Detroit for the Departure From, would you want them "Trip Departures by Month" "results" to show only those from the two select airports?
Yep, I'd like the filters results to take into account both the pre-filters (in menu or list settings) + the selected filters (on the list view) + URL filters.

As I said above, (on my setup) if I filter rows on two selected airports and if there's no departure on march for these airports, march will still be shown in "months" filter, that would be nice to indicate a "0" results for march so that they don't have to try the filter and land on a "no results" page.
Even if my "months" filter goes in a form, I still have about 10 different filters on my list and will surely have no results pages if several filters are applied...

But I will think a bit more about this and see if it's a deadly required development or not ! ;-)

I'm not keen on GROUP BYing because I'll have a form + filters + group by, etc... not so handy for users, but thanks for suggesting !
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top