Background
Currently the slider min/max is obtained from the facet data. The user interface it is a bit confusing because once you restrict the range, the min/max now adjusts to the range you just selected and is impossible to expand your selection.
Previously
This is an alternate approach to the same underlying issue in http://drupal.org/node/1239118 but it solves a slightly different problem. In that issue, the approach looked at was to obtain the global min/max value for a given query type.
Min/Max Irrespective of Data
In my situation, I want the slider to go from 1-5 even when there is no data with a value of 1.
This Patch
The approach here is to allow an user specified override of the min/max values used for the widget, irrespective of the actual facet data. There are a few questions around the behaviour that may need more consideration. Particularly, what if the user sets min to 10 and max blank, but the facet returns a min/max range of (2, 4). What should the max be then? Should we perhaps only allow min/max to be specified together? Currently in that situation, I leave min to 10 as specified, and clamp max to 10 also.
An alternate strategy I considered was to try to alter search results and override the min/max there but that seemed like the wrong place to do it as I think this is more a presentation layer (ie widget) issue.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 1440612-facet_slider_force_min_max-2.patch | 8.58 KB | levialliance |
| facet_slider_force_min_max.patch | 5.4 KB | levialliance |
Comments
Comment #1
levialliance commentedOne problem I didn't notice at first is that in Drupal.facetapi_slider.makeSlider() it assumes the initial position of the labels will be at the far left/far right. This no longer holds, and as soon as you start dragging the slider the labels 'pop' into the correct position.
This patch additionally adds javascript changes to correctly position the labels on startup. I couldn't find a way of triggering a jquery ui slide event without making assumptions about internal slider behaviour that may change in future. Assigning the slider value to the existing value will trigger the change event so that's the mechanism I used.
Comment #1.0
levialliance commentedRemove typo