-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.txt
119 lines (82 loc) · 3.87 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
jQuery MultiSelects plugin v0.3
Copyright (c) 2007 Rob Desbois,
2011 Yury Samsonov <[email protected]>
Latest version can be found at
http://code.google.com/p/jqmultiselects/
LICENCE
Dual licensed under the MIT and GPL licenses:
http://www.opensource.org/licenses/mit-license.php
http://www.gnu.org/licenses/gpl.html
Example icons from http://www.famfamfam.com/lab/icons/silk/
Licenced under Creative Commons Attribution 2.5 License
http://creativecommons.org/licenses/by/2.5/
This plugin was inspired by SelectFilter element in Django admin interface.
It adds the addition of common behaviour to <select> elements allowing multiple
options to be selected.
ABOUT
SelectFilter element has two panels: "source", which contains available options,
and "destination" with options selected by user.
jqMultiSelects enables you to deal purely with the presentation of your
<select> elements, and then use the plugin to attach common behaviours to them.
Current features include:
* Set up double-click transferring of options from one select to another;
* Enable transferring of multiple options via an external element, e.g.
<img>, <button>, <input>, etc.;
* Automatic submission of <option> elements with parent form submission;
* Callbacks to hook into the process;
* Automatic sorting for lists.
You can use some trigger buttons to move options from source to destination
and vice versa. "Select" and "deselect" moves only selected elements,
"select all" and "deselect all" moves all elements in choosen direction.
EXAMPLE
To implement, start by creating your <select> elements:
<select name="left" id="select_left" multiple="multiple">
<option>Item 1</option>
<option>Item 2</option>
</select></td>
<a id="options_right" href="#">move right</a>
<a id="options_left" href="#">move left</a>
<select name="right" id="select_right" multiple="multiple">
<option>Item 3</option>
<option>Item 4</option>
</select>
Then, to add the Multi-Selects behaviour to these listboxes, simply call
multiSelect() function for the "source" element with "destination" as
a first argument and options as second one:
$(function() {
var options = {
button_select: "#options_right",
button_deselect: "#options_left"
};
$("#select_left").multiSelect("#select_right", options);
});
By default all options placed to "destination" element will be sent to a
server on the form submission.
OPTIONS
All options are optional.
Trigger elements:
* button_select - "select" button;
* button_select_all - "select all" button
* button_deselect - button to remove selected options from "destination";
* button_deselect_all - button to remove all options from "desttination".
Use jQuery selector or jq-wrapped element as a value.
Sorting options:
* autoSort - if true, options will be sorted after moving elements (enabled
by default);
* sortType - "value" (default): sort by options text,
"key": by <option>s "value" attribute,
function(a, b) {...}: your own sorting functon as for jQuery
sort() function.
* sortDesc - if true, options sorted in reverse order (false by default),
not used for you own sorting function.
Callbacks:
* beforeMove - "before move" callback, if returns false, no items will be moved;
* afterMove - after move callback.
Callbacks should get three arguments: "source" list, "destination" list and
"action". Actions are: "select", "deselect" and "all".
Other options:
* keepSelected - keep moved items selected, false by default (default value
may or may not be changed in future versions, if it important for you do not
relay on default value);
* autoSubmit - select all child <option>s on parent form submission. I have
no idea why you should want to change it, but well...