diff options
author | Marius Halden <marius.h@lden.org> | 2019-10-30 19:28:55 +0100 |
---|---|---|
committer | Marius Halden <marius.h@lden.org> | 2019-10-30 19:28:55 +0100 |
commit | 377bd96aab7cad3434185c30eb908c9da447fe40 (patch) | |
tree | 7ec5527e205d5b62caaa862a7de8cd25199c8bf0 /docs/_posts/2016-12-06-v2.0-multi-select.md | |
parent | 56f61b1441070aa0b9ddcfc74aca46c20313609f (diff) | |
parent | 92b253904062edd533e55c22824de6fd01e2f7c1 (diff) |
Merge tag 'v2.6' into fiksgatami-dev
Diffstat (limited to 'docs/_posts/2016-12-06-v2.0-multi-select.md')
-rw-r--r-- | docs/_posts/2016-12-06-v2.0-multi-select.md | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/docs/_posts/2016-12-06-v2.0-multi-select.md b/docs/_posts/2016-12-06-v2.0-multi-select.md new file mode 100644 index 000000000..aaa5c9fa9 --- /dev/null +++ b/docs/_posts/2016-12-06-v2.0-multi-select.md @@ -0,0 +1,46 @@ +--- +layout: post +title: Version 2.0 – Multi-select dropdown jQuery plugin +author: zarino +--- + +There are several types of 'list page' on FixMyStreet: for example, when you +view all reports from a specific body, or when you log into your account to see +reports you have made. + +For quite a while now, users have been able to filter these by state (eg +'fixed' or 'in progress') or category (eg 'pothole', 'streetlight', etc), but a +recent suggestion from Oxfordshire County Council prompted us to look again at +this functionality and improve it. + +So now it's simple to filter by multiple states or categories: want to see all +unfixed potholes? All streetlights or flytipping reports that are fixed? No +problem. + +HTML's `<select multiple>` is not the nicest tool in the box, especially when +it comes to actually selecting multiple options. It usually involves holding +down a key, but that key is different depending upon your operating system. + +So I looked at existing JavaScript plugins and finding nothing suitable created +a very simple jQuery plugin which is available at +[https://github.com/mysociety/jquery-multi-select](https://github.com/mysociety/jquery-multi-select). + +By default, it converts a multiple select into a dropdown with checkboxes: + +<img src="/assets/posts/multi-select-people.png" alt=""> + +The options can be wrapped within a container to stop the dropdown overlapping other content: + +<img src="/assets/posts/multi-select-line-wrap.png" alt=""> + +With options in the constructor, you can specify text for when all/no options +are selected, and specify groups of options as presets that will be listed at +the top of the dropdown: + +<img src="/assets/posts/multi-select-groups.png" alt=""> + +On FixMyStreet, we have used this for both the state and category filters on list pages: + +<img src="/assets/posts/multi-select.png" alt=""> + +Let us know if you find the plugin useful! |