Skip to content

Commit 5d42519

Browse files
SteveTheTechiemlh758
authored andcommitted
New features (#751)
Fixes: Fix #750 Fix #721 Fix #605 Fix #467 Fix #454 Fix #436 Fix #232 Fix #163, Fix #86 ### Many new features and improvements: 1. Expanded on iconSet concept to create linkInfo option to allow configuration of all header link attributes, including icons, text, and titles.s. 2. Menu height can now be dynamically resized via the jQuery UI resizable widget, if loaded and resizableMenu option set to true. 3. Fixed some issues w/ the menu height getting mangled when filtering was in used. 4. Modifed how header option is used. Can still set to false to hide header, but now it is also used to specify what header links are seen and in what order. 5. The multiselect can now also be used as a fixed list box (always open; no pop-up) via the listbox option. 6. New options groupsSelectable and groupsCollapsable control whether option groups can be selected and/or collapsed, respectively. 7. Option groups can now be set to be collapsable. A new small button shows up at the left of each option group heading to collapse/expand the option group. 8. New resync and value methods allow quickly updating the widget options checked state from the underlying native select. 9. Can now use the up/down keys on closed single select to change the selected option if the button is focussed. 10. Fixed a previously unknown bug caused by binding menu events to the outer $menu container div instead of the $checkboxes container. This bug caused the menu events handler to also try to handle header events. 11. Added the ability to reference option groups by their label or index for use as a filter. Now usable programmatically in addOption, checkAll, uncheckAll, flipAll, collapseAll, and expandAll. 12. Simplified the auto width determination for the _setMenuWidth() method by tweaking the related CSS rules. As a benefit, the _getScrollBarWidth() function has been eliminated. 13. Updated and simplified the _setMenuHeight() method to allow it to better work with filtering. 14. Re-wrote the filter widget--can now search option group headings and supports alternative filter rules. 15. Updated and added unit tests. 16. Updated demos and changed theme to Redmond--no more ugly construction orange. 17. Updated i18n files for new linkInfo option format. 18. Using .data('ech-multiselect') to fetch the instance now
1 parent 0a340f3 commit 5d42519

34 files changed

+1048
-511
lines changed

css/jquery.multiselect.css

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,41 @@
1-
.ui-multiselect {box-sizing: border-box; padding:2px 0 2px 4px; text-align:left;}
1+
.ui-multiselect {box-sizing: border-box; padding:2px 0 2px 4px; text-align:left; width: auto;}
22
.ui-multiselect .ui-multiselect-open { float:right }
33

4-
.ui-multiselect-menu { display:none; box-sizing:border-box; position:absolute; text-align:left; z-index:101; width:auto; padding:3px;}
4+
.ui-multiselect-menu { display:none; box-sizing:border-box; position:absolute; text-align:left; z-index: 101; width:auto; height:auto; padding:3px; }
5+
.ui-multiselect-menu.ui-multiselect-listbox {position:relative; z-index: 0;}
56

67
.ui-multiselect-header { display:block; box-sizing:border-box; position:relative; width:auto; padding:3px 0 3px 4px; margin-bottom:3px;}
78
.ui-multiselect-header > ul { font-size:0.9em }
8-
.ui-multiselect-header > ul > li { float:left; padding:0 10px 0 0;}
9+
.ui-multiselect-header li { float:left; margin:0 10px 0 0;}
910
.ui-multiselect-header a { text-decoration:none; }
1011
.ui-multiselect-header a:hover { text-decoration:underline; cursor: pointer;}
1112
.ui-multiselect-header .ui-icon { float:left; }
12-
.ui-multiselect-header .ui-multiselect-close { float:right; padding-right:0; text-align:right; }
13+
.ui-multiselect-header .ui-multiselect-close { float:right; margin-right:0; text-align:right; }
1314

1415
.ui-multiselect-checkboxes { display:block; box-sizing:border-box; position:relative; overflow:auto; width: auto; border: 0;}
15-
.ui-multiselect-checkboxes label { border:1px solid transparent; cursor:default; display:block; padding:3px 1px;}
16-
.ui-multiselect-checkboxes label > input { position:relative; top:1px; }
17-
.ui-multiselect-checkboxes label img { height: 30px; vertical-align: middle; padding-right: 3px;}
18-
.ui-multiselect-checkboxes > .ui-multiselect-optgroup > a { border-bottom:1px solid; cursor: pointer; display:block; font-weight:bold; margin:1px 0; padding:3px; text-align:center; text-decoration:none; }
19-
.ui-multiselect-checkboxes > .ui-multiselect-optgroup > ul { padding: 3px; }
2016
.ui-multiselect-checkboxes li:not(.ui-multiselect-optgroup) { clear:both; font-size:0.9em; list-style: none; padding-right:3px;}
17+
.ui-multiselect-checkboxes label { border:1px solid transparent; cursor:default; display:block; padding:3px 1px;}
18+
.ui-multiselect-checkboxes input { position:relative; top:1px; cursor: pointer;}
19+
.ui-multiselect-checkboxes img { height: 30px; vertical-align: middle; margin-right: 3px;}
20+
.ui-multiselect-grouplabel { border-bottom:1px solid; cursor: pointer; display:block; font-weight:bold; margin:1px 0; padding:3px; text-align:center; text-decoration:none; }
21+
.ui-multiselect-optgroup > ul { padding: 3px; }
2122
.ui-multiselect-columns { display: inline-block; vertical-align: top; }
23+
.ui-multiselect-collapser { float: left; padding: 0 1px; margin: 0; }
24+
.ui-multiselect-collapsed > ul { display:none }
2225

2326
.ui-multiselect-single .ui-multiselect-checkboxes input { left:-9999px; position:absolute !important; top: auto !important; }
2427
.ui-multiselect-single .ui-multiselect-checkboxes label { padding:5px !important }
2528

26-
.ui-multiselect.ui-multiselect-nowrap { white-space: nowrap}
27-
.ui-multiselect.ui-multiselect-nowrap > span {display: inline-block}
29+
.ui-multiselect.ui-multiselect-nowrap { white-space: nowrap }
30+
.ui-multiselect.ui-multiselect-nowrap > span { display: inline-block }
2831
.ui-multiselect-checkboxes.ui-multiselect-nowrap li,
29-
.ui-multiselect-checkboxes.ui-multiselect-nowrap a{ white-space: nowrap}
32+
.ui-multiselect-checkboxes.ui-multiselect-nowrap a { white-space: nowrap }
3033

3134
.ui-multiselect-measure > .ui-multiselect-header,
32-
.ui-multiselect-measure > .ui-multiselect-checkboxes { float:left; }
35+
.ui-multiselect-measure > .ui-multiselect-checkboxes { float: left; }
36+
.ui-multiselect-measure > .ui-multiselect-checkboxes { margin: 4px; overflow-y: scroll; }
37+
38+
.ui-multiselect-resize { border: 2px dotted #00F }
3339

3440
@media print{
3541
.ui-multiselect-menu {display: none;}

css/jquery.multiselect.filter.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.ui-multiselect-hasfilter ul { position:relative; top:2px }
2-
.ui-multiselect-filter { float:left; margin-right:10px; font-size:11px }
2+
.ui-multiselect-filter { float:left; margin-right:10px; font-size:11px; width:100%; }
33
.ui-multiselect-filter input { width:100px; font-size:10px; margin-left:5px; height:15px; padding:2px; border:1px solid #292929; -webkit-appearance:textfield; -webkit-box-sizing:content-box; }
4+
.ui-multiselect-excluded {display: none}

demos/animations.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<link rel="stylesheet" type="text/css" href="../css/jquery.multiselect.css" />
77
<link rel="stylesheet" type="text/css" href="assets/style.css" />
88
<link rel="stylesheet" type="text/css" href="assets/prettify.css" />
9-
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/ui-lightness/jquery-ui.css" />
9+
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/redmond/jquery-ui.css" />
1010
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
1111
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
1212
<script type="text/javascript" src="../src/jquery.multiselect.js"></script>

demos/assets/ba.hashchange.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demos/basic.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<link rel="stylesheet" type="text/css" href="../css/jquery.multiselect.css" />
77
<link rel="stylesheet" type="text/css" href="assets/style.css" />
88
<link rel="stylesheet" type="text/css" href="assets/prettify.css" />
9-
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/ui-lightness/jquery-ui.css" />
9+
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/redmond/jquery-ui.css" />
1010
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
1111
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
1212
<script type="text/javascript" src="assets/prettify.js"></script>

demos/callbacks.htm

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<link rel="stylesheet" type="text/css" href="../css/jquery.multiselect.css" />
77
<link rel="stylesheet" type="text/css" href="assets/style.css" />
88
<link rel="stylesheet" type="text/css" href="assets/prettify.css" />
9-
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/ui-lightness/jquery-ui.css" />
9+
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/redmond/jquery-ui.css" />
1010
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
1111
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
1212
<script type="text/javascript" src="../src/jquery.multiselect.js"></script>
@@ -15,7 +15,7 @@
1515
$(function(){
1616

1717
var $callback = $("#callback");
18-
18+
1919
$("select").multiselect({
2020
click: function(event, ui){
2121
$callback.text(ui.value + ' ' + (ui.checked ? 'checked' : 'unchecked') );
@@ -42,8 +42,15 @@
4242
var values = $.map(ui.inputs, function(checkbox){
4343
return checkbox.value;
4444
}).join(", ");
45-
45+
4646
$callback.html("<strong>Checkboxes " + (ui.checked ? "checked" : "unchecked") + ":</strong> " + values);
47+
},
48+
groupsCollapsable: true,
49+
beforecollapsetoggle: function(){
50+
$callback.text("Option group about to be collapsed/expanded...");
51+
},
52+
collapsetoggle: function(){
53+
$callback.text("Option group collapsed/expanded");
4754
}
4855
});
4956

@@ -54,7 +61,7 @@
5461

5562
<h2>Callbacks &amp; Events</h2>
5663
<p>Demonstrating beforeopen, open, beforeclose, close, click, checkall, uncheckall, and optgrouptoggle callbacks/events. Note that you can either
57-
pass in an event handler in the options object upon initialization, or bind to the event (including the multiselect prefix). For example, to add an
64+
pass in an event handler in the options object upon initialization, or bind to the event (including the multiselect prefix). For example, to add an
5865
"open" handler, you can also use <code class="prettyprint">$("select").bind("multiselectopen", fn);</code></p>
5966
<p class="message success" id="callback">Callback target</p>
6067

@@ -101,8 +108,15 @@ <h2>Callbacks &amp; Events</h2>
101108
var values = $.map(ui.inputs, function(checkbox){
102109
return checkbox.value;
103110
}).join(", ");
104-
111+
105112
$callback.html("<strong>Checkboxes " + (ui.checked ? "checked" : "unchecked") + ":</strong> " + values);
113+
},
114+
groupsCollapsable: true,
115+
beforecollapsetoggle: function(){
116+
$callback.text("Option group about to be collapsed/expanded...");
117+
},
118+
collapsetoggle: function(){
119+
$callback.text("Option group collapsed/expanded");
106120
}
107121
});
108122
</pre>

demos/enabledisable.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<link rel="stylesheet" type="text/css" href="../css/jquery.multiselect.css" />
77
<link rel="stylesheet" type="text/css" href="assets/style.css" />
88
<link rel="stylesheet" type="text/css" href="assets/prettify.css" />
9-
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/ui-lightness/jquery-ui.css" />
9+
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/redmond/jquery-ui.css" />
1010
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
1111
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
1212
<script type="text/javascript" src="../src/jquery.multiselect.js"></script>

demos/filter.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<link rel="stylesheet" type="text/css" href="../css/jquery.multiselect.filter.css" />
88
<link rel="stylesheet" type="text/css" href="assets/style.css" />
99
<link rel="stylesheet" type="text/css" href="assets/prettify.css" />
10-
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/ui-lightness/jquery-ui.css" />
10+
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/redmond/jquery-ui.css" />
1111
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
1212
<script type="text/javascript" src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
1313
<script type="text/javascript" src="../src/jquery.multiselect.js"></script>

demos/headers.htm

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,28 @@
55
<title>jQuery MultiSelect Widget Demo</title>
66
<link rel="stylesheet" type="text/css" href="../css/jquery.multiselect.css" />
77
<link rel="stylesheet" type="text/css" href="assets/style.css" />
8-
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/ui-lightness/jquery-ui.css" />
8+
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/redmond/jquery-ui.css" />
99
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
1010
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
1111
<script type="text/javascript" src="../src/jquery.multiselect.js"></script>
1212
<script type="text/javascript">
1313
$(function(){
14-
14+
1515
// default
1616
$("#test-1").multiselect({
17-
header: true
17+
header: ['checkAll','uncheckAll']
1818
});
19-
19+
2020
// off
2121
$("#test-2").multiselect({
2222
header: false
2323
});
24-
24+
2525
// custom text
2626
$("#test-3").multiselect({
2727
header: "Choose options below"
2828
});
29-
29+
3030
});
3131
</script>
3232

@@ -37,7 +37,7 @@ <h2>Headers</h2>
3737
<p>The header option can be used in three ways:</p>
3838

3939
<form>
40-
<h3><code>header: true</code> (default)</h3>
40+
<h3><code>header: ['checkAll','uncheckAll']</code> (default)</h3>
4141
<select id="test-1" multiple="multiple" size="5">
4242
<option value="option1">Option 1</option>
4343
<option value="option2">Option 2</option>
@@ -47,7 +47,7 @@ <h3><code>header: true</code> (default)</h3>
4747
<option value="option6">Option 6</option>
4848
<option value="option7">Option 7</option>
4949
</select>
50-
50+
5151
<h3><code>header: false</code></h3>
5252
<select id="test-2" multiple="multiple" size="5">
5353
<option value="option1">Option 1</option>
@@ -58,7 +58,7 @@ <h3><code>header: false</code></h3>
5858
<option value="option6">Option 6</option>
5959
<option value="option7">Option 7</option>
6060
</select>
61-
61+
6262
<h3><code>header: "Choose options below"</code></h3>
6363
<select id="test-3" multiple="multiple" size="5">
6464
<option value="option1">Option 1</option>

demos/maxchecked.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<link rel="stylesheet" type="text/css" href="../css/jquery.multiselect.css" />
77
<link rel="stylesheet" type="text/css" href="assets/style.css" />
88
<link rel="stylesheet" type="text/css" href="assets/prettify.css" />
9-
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/ui-lightness/jquery-ui.css" />
9+
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/redmond/jquery-ui.css" />
1010
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
1111
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
1212
<script type="text/javascript" src="../src/jquery.multiselect.js"></script>

0 commit comments

Comments
 (0)