forked from crlcu/multiselect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
481 lines (431 loc) · 26.1 KB
/
index.html
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="description" lang="en" content="jQuery multiselect plugin with two sides. The user can select one or more items and send them to the other side."/>
<meta name="keywords" lang="en" content="jQuery multiselect plugin" />
<base href="//crlcu.github.io/multiselect/" />
<title>jQuery multiselect plugin with two sides</title>
<link rel="icon" type="image/x-icon" href="https://github.com/favicon.ico" />
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" />
<link rel="stylesheet" href="lib/google-code-prettify/prettify.css" />
<link rel="stylesheet" href="css/style.css" />
</head>
<body>
<a href="https://github.com/crlcu/multiselect" class="github ribbon">
<img src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png" alt="Fork me on GitHub">
</a>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand scroll" href="#">Multiselect</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="#" class="scroll">Home</a></li>
<li><a href="#documentation" class="scroll">Documentation</a></li>
<li><a href="#browser-support" class="scroll">Browser Support</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Examples <span class="caret"></span ></a>
<ul class="dropdown-menu" role="menu">
<li><a href="examples/zero-configuration.html">Zero configuration</a></li>
<li><a href="examples/data-options.html">With <code>data</code> options</a></li>
<li><a href="examples/javascript-options.html">With <code>javascript</code> options</a></li>
<li><a href="examples/search.html">With search</a></li>
<li><a href="examples/keep-rendering-sort.html">Keep rendering sort</a></li>
<li><a href="examples/undo-redo.html">Undo / Redo</a></li>
<li><a href="examples/multiple-destinations.html">Multiple destinations</a></li>
<li><a href="examples/optgroup.html">With <code>optgroup</code></a></li>
<li><a href="examples/move-up-down.html">With move <code>up</code>/<code>down</code> buttons</a></li>
</ul>
</li>
<li><a href="#download" class="scroll">Download</a></li>
</ul>
</div>
</div>
</div>
</div>
<div id="wrap" class="container">
<div id="home">
<div class="jumbotron">
<h1>Multiselect</h1>
<p>This is a small <a href="http://jquery.com/" target="_blank">jQuery</a> plugin that helps you improve the
<strong>user experience</strong> regarding the use of multiple cross selects.
</p>
<p>It is very <strong>easy to install</strong> and can be <strong>easily customized</strong> because it has <strong>callbacks</strong> for many events, such as :
<div class="row">
<div class="col-xs-6">
<ul>
<li><a href="#beforeMoveToRight">beforeMoveToRight</a></li>
<li><a href="#beforeMoveToLeft">beforeMoveToLeft</a></li>
</ul>
</div>
<div class="col-xs-6">
<ul>
<li><a href="#afterMoveToRight">afterMoveToRight</a></li>
<li><a href="#afterMoveToLeft">afterMoveToLeft</a></li>
</ul>
</div>
</div>
</p>
<p>It also has a <a href="#sort">sort</a> function that can be defined in order of your needs for each multiple select.</p>
<p>You can <strong>fully customize</strong> it via <strong>CSS</strong>, you can extend it and have as <strong>many multi selects</strong> as you want on the page.</p>
<p><a href="#documentation" class="btn btn-primary btn-lg">Documentation</a></p>
</div>
</div>
<div id="documentation">
<div class="page-header"><h3>Documentation</h3></div>
<h4>Options:</h4>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Name</th>
<th>type</th>
<th>default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>right</td>
<td><code>string</code> jQuery selector</td>
<td><code>multiselect_id</code>_to</td>
<td>The <code>select</code> where the options are moved to</td>
</tr>
<tr>
<td>rightSelected</td>
<td><code>string</code> jQuery selector</td>
<td><code>multiselect_id</code>_rightSelected</td>
<td>The <code>button</code> that moves selected options from left to right</td>
</tr>
<tr>
<td>rightAll</td>
<td><code>string</code> jQuery selector</td>
<td><code>multiselect_id</code>_rightAll</td>
<td>The <code>button</code> that moves all options from left to right</td>
</tr>
<tr>
<td>leftSelected</td>
<td><code>string</code> jQuery selector</td>
<td><code>multiselect_id</code>_leftSelected</td>
<td>The <code>button</code> that moves selected options from right to left</td>
</tr>
<tr>
<td>leftAll</td>
<td><code>string</code> jQuery selector</td>
<td><code>multiselect_id</code>_leftAll</td>
<td>The <code>button</code> that moves all options from right to left</td>
</tr>
<tr>
<td>undo</td>
<td><code>string</code> jQuery selector</td>
<td><code>multiselect_id</code>_undo</td>
<td>The <code>button</code> that triggers the undo action</td>
</tr>
<tr>
<td>redo</td>
<td><code>string</code> jQuery selector</td>
<td><code>multiselect_id</code>_redo</td>
<td>The <code>button</code> that triggers the redo action</td>
</tr>
<tr>
<td>moveUp</td>
<td><code>string</code> jQuery selector</td>
<td><code>multiselect_id</code>_move_up</td>
<td>The <code>button</code> that move options from right side to the top</td>
</tr>
<tr>
<td>moveDown</td>
<td><code>string</code> jQuery selector</td>
<td><code>multiselect_id</code>_move_down</td>
<td>The <code>button</code> that move options from right side to the bottom</td>
</tr>
<tr>
<td>startUp</td>
<td><code>function</code> or <code>false</code></td>
<td><code>remove</code> from left all options that are present in right</td>
<td>Whatever you want to do with <code>$left</code> and <code>$right</code> elements when the <code>multiselect</code> plugin is initialised</td>
</tr>
<tr id="sort">
<td>sort</td>
<td><code>function</code> or <code>false</code></td>
<td><code>sort</code> options alphabetically</td>
<td>Will sort options when an action happend into right or left elements.</td>
</tr>
<tr id="beforeMoveToRight">
<td>beforeMoveToRight</td>
<td><code>function</code></td>
<td>return <code>true</code></td>
<td>
Whatever you want to do with <code>$left</code>, <code>$right</code> and <code>$options</code> elements before they are moved to right.<br/><br/>
<code>beforeMoveToRight: function($left, $right, $options) { ...; return Boolean; }</code>.<br/><br/>
<ul>
<li><code>$left</code> - jQuery element pointing to left side <code>select</code> element</li>
<li><code>$right</code> - jQuery element pointing to right side <code>select</code> element</li>
<li><code>$options</code> - jQuery element containing all selected options</li>
</ul>
Keep in mind that this function must return a boolean value.<br/>
<ul>
<li><code>true</code> will let the action to be performed</li>
<li><code>false</code> will stop the action</li>
</ul>
</td>
</tr>
<tr id="moveToRight">
<td>moveToRight</td>
<td><code>function</code></td>
<td>return <code>this</code></td>
<td>
If you want to define your own <code>moveToRight</code> functionality you can do this by defining<br/><br/>
<code>moveToRight: function(Multiselect, $options, event, silent, skipStack) { ... }</code><br/><br/>
<ul>
<li><code>Multiselect</code> - current instance of multiselect</li>
<li><code>$options</code> - jQuery element containing all selected options</li>
<li><code>event</code> - the event that initialised the action</li>
<li><code>silent</code> - <code>boolean</code> that tells if you have to trigger <code>beforeMoveToRight</code> and <code>afterMoveToRight</code></li>
<li><code>skipStack</code> - <code>boolean</code> that tells if you have to handle <code>undo/redo</code> stack</li>
</ul>
</td>
</tr>
<tr id="afterMoveToRight">
<td>afterMoveToRight</td>
<td><code>function</code></td>
<td>no action</td>
<td>
Whatever you want to do with <code>$left</code>, <code>$right</code> and <code>$options</code> elements after they are moved to right.<br/><br/>
<code>afterMoveToRight: function($left, $right, $options) { ...; }</code><br/><br/>
<ul>
<li><code>$left</code> - jQuery element pointing to left side <code>select</code> element</li>
<li><code>$right</code> - jQuery element pointing to right side <code>select</code> element</li>
<li><code>$options</code> - jQuery element containing all selected options</li>
</ul>
</td>
</tr>
<tr id="beforeMoveToLeft">
<td>beforeMoveToLeft</td>
<td><code>function</code></td>
<td>return <code>true</code></td>
<td>
Whatever you want to do with <code>$left</code>, <code>$right</code> and <code>$options</code> elements before they are moved to left.<br/><br/>
<code>beforeMoveToLeft: function($left, $right, $options) { ...; return Boolean; }</code>.<br/><br/>
<ul>
<li><code>$left</code> - jQuery element pointing to left side <code>select</code> element</li>
<li><code>$right</code> - jQuery element pointing to right side <code>select</code> element</li>
<li><code>$options</code> - jQuery element containing all selected options</li>
</ul>
Keep in mind that this function must return a boolean value.<br/>
<ul>
<li><code>true</code> will let the action to be performed</li>
<li><code>false</code> will stop the action</li>
</ul>
</td>
</tr>
<tr id="moveToLeft">
<td>moveToLeft</td>
<td><code>function</code></td>
<td>return <code>this</code></td>
<td>
If you want to define your own <code>moveToLeft</code> functionality you can do this by defining<br/><br/>
<code>moveToLeft: function(Multiselect, $options, event, silent, skipStack) { ... }</code><br/><br/>
<ul>
<li><code>Multiselect</code> - current instance of multiselect</li>
<li><code>$options</code> - jQuery element containing all selected options</li>
<li><code>event</code> - the event that initialised the action</li>
<li><code>silent</code> - <code>boolean</code> that tells if you have to trigger <code>beforeMoveToRight</code> and <code>afterMoveToRight</code></li>
<li><code>skipStack</code> - <code>boolean</code> that tells if you have to handle <code>undo/redo</code> stack</li>
</ul>
</td>
</tr>
<tr id="afterMoveToLeft">
<td>afterMoveToLeft</td>
<td><code>function</code></td>
<td>no action</td>
<td>
Whatever you want to do with <code>$left</code>, <code>$right</code> and <code>$options</code> elements after they are moved to right.<br/><br/>
<code>afterMoveToLeft: function($left, $right, $options) { ...; }</code><br/><br/>
<ul>
<li><code>$left</code> - jQuery element pointing to left side <code>select</code> element</li>
<li><code>$right</code> - jQuery element pointing to right side <code>select</code> element</li>
<li><code>$options</code> - jQuery element containing all selected options</li>
</ul>
</td>
</tr>
<tr id="beforeMoveUp">
<td>beforeMoveUp</td>
<td><code>function</code></td>
<td>return <code>true</code></td>
<td>
Whatever you want to do with <code>$options</code> elements before they are moved up.<br/><br/>
<code>beforeMoveUp: function( $options) { ...; return Boolean; }</code>.<br/><br/>
<ul>
<li><code>$options</code> - jQuery element containing all selected options</li>
</ul>
Keep in mind that this function must return a boolean value.<br/>
<ul>
<li><code>true</code> will let the action to be performed</li>
<li><code>false</code> will stop the action</li>
</ul>
</td>
</tr>
<tr id="afterMoveUp">
<td>afterMoveUp</td>
<td><code>function</code></td>
<td>no action</td>
<td>
Whatever you want to do with <code>$options</code> elements after they are moved up.<br/><br/>
<code>afterMoveUp: function($options) { ...; }</code><br/><br/>
<ul>
<li><code>$options</code> - jQuery element containing all selected options</li>
</ul>
</td>
</tr>
<tr id="beforeMoveDown">
<td>beforeMoveDown</td>
<td><code>function</code></td>
<td>return <code>true</code></td>
<td>
Whatever you want to do with <code>$options</code> elements before they are moved down.<br/><br/>
<code>beforeMoveDown: function( $options) { ...; return Boolean; }</code>.<br/><br/>
<ul>
<li><code>$options</code> - jQuery element containing all selected options</li>
</ul>
Keep in mind that this function must return a boolean value.<br/>
<ul>
<li><code>true</code> will let the action to be performed</li>
<li><code>false</code> will stop the action</li>
</ul>
</td>
</tr>
<tr id="afterMoveDown">
<td>afterMoveDown</td>
<td><code>function</code></td>
<td>no action</td>
<td>
Whatever you want to do with <code>$options</code> elements after they are moved down.<br/><br/>
<code>afterMoveDown: function($options) { ...; }</code><br/><br/>
<ul>
<li><code>$options</code> - jQuery element containing all selected options</li>
</ul>
</td>
</tr>
<tr>
<td>keepRenderingSort</td>
<td><code>boolean</code></td>
<td><code>false</code></td>
<td>
When you want to keep options sorted as they was rendered, <code>keepRenderingSort</code> must be <code>true</code>.<br/>
When <code>keepRenderingSort</code> is <code>true</code>, <code>sort</code> function will be ignored.
</td>
</tr>
<tr>
<td>submitAllLeft</td>
<td><code>boolean</code></td>
<td><code>true</code></td>
<td>
When you don’t want to send all options from the left side to server, <code>submitAllLeft</code> must be <code>false</code>.
</td>
</tr>
<tr>
<td>submitAllRight</td>
<td><code>boolean</code></td>
<td><code>true</code></td>
<td>
When you don’t want to send all options from the right side to server, <code>submitAllRight</code> must be <code>false</code>.
</td>
</tr>
<tr>
<td>search</td>
<td><code>Object</code></td>
<td><code>null</code></td>
<td>
When you want to have search fields for <code>left</code> and <code>right</code> elements you can do this by providing following value:<br/>
<pre class="prettyprint linenums">
search: {
left: '<input type="text" name="q" class="form-control" placeholder="Search..." />',
right: '<input type="text" name="q" class="form-control" placeholder="Search..." />',
}
</pre>
When you want to have search field only for <code>left</code> element you can do this by providing following value:<br/>
<pre class="prettyprint linenums">
search: {
left: '<input type="text" name="q" class="form-control" placeholder="Search..." />',
}
</pre>
</td>
</tr>
<tr id="fireSearch">
<td>fireSearch</td>
<td><code>function</code></td>
<td>return <code>true</code> if search length is great than 1</td>
<td>
Tell to multiselect when to start applying the search.<br/><br/>
<code>fireSearch: function(value) { ...; return Boolean; }</code><br/><br/>
<ul>
<li><code>value</code> - String search entered by the user</li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
<div id="browser-support">
<div class="page-header"><h3>Browser Support</h3></div>
<h4>The following browsers are supported:</h4>
<ul>
<li>Internet Explorer 7+</li>
<li>Google Chrome</li>
<li>Mozilla Firefox</li>
<li>Safari</li>
<li>Opera</li>
</ul>
</div>
<div id="download">
<div class="page-header"><h3>Download</h3></div>
<div class="row">
<div class="col-xs-4">
<p><a class="btn btn-lg btn-primary" href="https://raw.github.com/crlcu/multiselect/master/dist/js/multiselect.js">Download multiselect.js</a></p>
</div>
<div class="col-xs-4">
<p><a class="btn btn-lg btn-success" href="https://raw.github.com/crlcu/multiselect/master/dist/js/multiselect.min.js">Download multiselect.min.js</a></p>
</div>
<div class="col-xs-4">
<p><a class="btn btn-lg btn-info" href="https://github.com/crlcu/multiselect/archive/master.zip">Download multiselect.zip</a></p>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-39934286-1', 'github.com');
ga('send', 'pageview');
</script>
<script type="text/javascript">
$(document).ready(function() {
// make code pretty
window.prettyPrint && prettyPrint();
if ( window.location.hash ) {
scrollTo(window.location.hash);
}
$('.nav').on('click', 'a.scroll', function(e) {
scrollTo($(this).attr('href'));
});
});
function scrollTo( id ) {
if ( $(id).length ) {
$('html,body').animate({scrollTop: $(id).offset().top - 60},'slow');
}
}
</script>
</body>
</html>