index.html 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <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."/>
  5. <meta name="keywords" lang="en" content="jQuery multiselect plugin" />
  6. <base href="//crlcu.github.io/multiselect/" />
  7. <title>jQuery multiselect plugin with two sides</title>
  8. <link rel="icon" type="image/x-icon" href="https://github.com/favicon.ico" />
  9. <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" />
  10. <link rel="stylesheet" href="lib/google-code-prettify/prettify.css" />
  11. <link rel="stylesheet" href="css/style.css" />
  12. </head>
  13. <body>
  14. <a href="https://github.com/crlcu/multiselect" class="github ribbon">
  15. <img src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png" alt="Fork me on GitHub">
  16. </a>
  17. <div class="navbar navbar-inverse navbar-fixed-top">
  18. <div class="navbar-inner">
  19. <div class="container">
  20. <div class="navbar-header">
  21. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
  22. <span class="sr-only">Toggle navigation</span>
  23. <span class="icon-bar"></span>
  24. <span class="icon-bar"></span>
  25. <span class="icon-bar"></span>
  26. </button>
  27. <a class="navbar-brand scroll" href="#">Multiselect</a>
  28. </div>
  29. <div class="collapse navbar-collapse">
  30. <ul class="nav navbar-nav">
  31. <li><a href="#" class="scroll">Home</a></li>
  32. <li><a href="#documentation" class="scroll">Documentation</a></li>
  33. <li><a href="#browser-support" class="scroll">Browser Support</a></li>
  34. <li class="dropdown">
  35. <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Examples <span class="caret"></span ></a>
  36. <ul class="dropdown-menu" role="menu">
  37. <li><a href="examples/zero-configuration.html">Zero configuration</a></li>
  38. <li><a href="examples/data-options.html">With <code>data</code> options</a></li>
  39. <li><a href="examples/javascript-options.html">With <code>javascript</code> options</a></li>
  40. <li><a href="examples/search.html">With search</a></li>
  41. <li><a href="examples/keep-rendering-sort.html">Keep rendering sort</a></li>
  42. <li><a href="examples/undo-redo.html">Undo / Redo</a></li>
  43. <li><a href="examples/multiple-destinations.html">Multiple destinations</a></li>
  44. <li><a href="examples/optgroup.html">With <code>optgroup</code></a></li>
  45. <li><a href="examples/move-up-down.html">With move <code>up</code>/<code>down</code> buttons</a></li>
  46. </ul>
  47. </li>
  48. <li><a href="#download" class="scroll">Download</a></li>
  49. </ul>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. <div id="wrap" class="container">
  55. <div id="home">
  56. <div class="jumbotron">
  57. <h1>Multiselect</h1>
  58. <p>This is a small <a href="http://jquery.com/" target="_blank">jQuery</a> plugin that helps you improve the
  59. <strong>user experience</strong> regarding the use of multiple cross selects.
  60. </p>
  61. <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 :
  62. <div class="row">
  63. <div class="col-xs-6">
  64. <ul>
  65. <li><a href="#beforeMoveToRight">beforeMoveToRight</a></li>
  66. <li><a href="#beforeMoveToLeft">beforeMoveToLeft</a></li>
  67. </ul>
  68. </div>
  69. <div class="col-xs-6">
  70. <ul>
  71. <li><a href="#afterMoveToRight">afterMoveToRight</a></li>
  72. <li><a href="#afterMoveToLeft">afterMoveToLeft</a></li>
  73. </ul>
  74. </div>
  75. </div>
  76. </p>
  77. <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>
  78. <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>
  79. <p><a href="#documentation" class="btn btn-primary btn-lg">Documentation</a></p>
  80. </div>
  81. </div>
  82. <div id="documentation">
  83. <div class="page-header"><h3>Documentation</h3></div>
  84. <h4>Options:</h4>
  85. <table class="table table-bordered table-striped">
  86. <thead>
  87. <tr>
  88. <th>Name</th>
  89. <th>type</th>
  90. <th>default</th>
  91. <th>description</th>
  92. </tr>
  93. </thead>
  94. <tbody>
  95. <tr>
  96. <td>right</td>
  97. <td><code>string</code> jQuery selector</td>
  98. <td><code>multiselect_id</code>_to</td>
  99. <td>The <code>select</code> where the options are moved to</td>
  100. </tr>
  101. <tr>
  102. <td>rightSelected</td>
  103. <td><code>string</code> jQuery selector</td>
  104. <td><code>multiselect_id</code>_rightSelected</td>
  105. <td>The <code>button</code> that moves selected options from left to right</td>
  106. </tr>
  107. <tr>
  108. <td>rightAll</td>
  109. <td><code>string</code> jQuery selector</td>
  110. <td><code>multiselect_id</code>_rightAll</td>
  111. <td>The <code>button</code> that moves all options from left to right</td>
  112. </tr>
  113. <tr>
  114. <td>leftSelected</td>
  115. <td><code>string</code> jQuery selector</td>
  116. <td><code>multiselect_id</code>_leftSelected</td>
  117. <td>The <code>button</code> that moves selected options from right to left</td>
  118. </tr>
  119. <tr>
  120. <td>leftAll</td>
  121. <td><code>string</code> jQuery selector</td>
  122. <td><code>multiselect_id</code>_leftAll</td>
  123. <td>The <code>button</code> that moves all options from right to left</td>
  124. </tr>
  125. <tr>
  126. <td>undo</td>
  127. <td><code>string</code> jQuery selector</td>
  128. <td><code>multiselect_id</code>_undo</td>
  129. <td>The <code>button</code> that triggers the undo action</td>
  130. </tr>
  131. <tr>
  132. <td>redo</td>
  133. <td><code>string</code> jQuery selector</td>
  134. <td><code>multiselect_id</code>_redo</td>
  135. <td>The <code>button</code> that triggers the redo action</td>
  136. </tr>
  137. <tr>
  138. <td>moveUp</td>
  139. <td><code>string</code> jQuery selector</td>
  140. <td><code>multiselect_id</code>_move_up</td>
  141. <td>The <code>button</code> that move options from right side to the top</td>
  142. </tr>
  143. <tr>
  144. <td>moveDown</td>
  145. <td><code>string</code> jQuery selector</td>
  146. <td><code>multiselect_id</code>_move_down</td>
  147. <td>The <code>button</code> that move options from right side to the bottom</td>
  148. </tr>
  149. <tr>
  150. <td>startUp</td>
  151. <td><code>function</code> or <code>false</code></td>
  152. <td><code>remove</code> from left all options that are present in right</td>
  153. <td>Whatever you want to do with <code>$left</code> and <code>$right</code> elements when the <code>multiselect</code> plugin is initialised</td>
  154. </tr>
  155. <tr id="sort">
  156. <td>sort</td>
  157. <td><code>function</code> or <code>false</code></td>
  158. <td><code>sort</code> options alphabetically</td>
  159. <td>Will sort options when an action happend into right or left elements.</td>
  160. </tr>
  161. <tr id="beforeMoveToRight">
  162. <td>beforeMoveToRight</td>
  163. <td><code>function</code></td>
  164. <td>return <code>true</code></td>
  165. <td>
  166. 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/>
  167. <code>beforeMoveToRight: function($left, $right, $options) { ...; return Boolean; }</code>.<br/><br/>
  168. <ul>
  169. <li><code>$left</code> - jQuery element pointing to left side <code>select</code> element</li>
  170. <li><code>$right</code> - jQuery element pointing to right side <code>select</code> element</li>
  171. <li><code>$options</code> - jQuery element containing all selected options</li>
  172. </ul>
  173. Keep in mind that this function must return a boolean value.<br/>
  174. <ul>
  175. <li><code>true</code> will let the action to be performed</li>
  176. <li><code>false</code> will stop the action</li>
  177. </ul>
  178. </td>
  179. </tr>
  180. <tr id="moveToRight">
  181. <td>moveToRight</td>
  182. <td><code>function</code></td>
  183. <td>return <code>this</code></td>
  184. <td>
  185. If you want to define your own <code>moveToRight</code> functionality you can do this by defining<br/><br/>
  186. <code>moveToRight: function(Multiselect, $options, event, silent, skipStack) { ... }</code><br/><br/>
  187. <ul>
  188. <li><code>Multiselect</code> - current instance of multiselect</li>
  189. <li><code>$options</code> - jQuery element containing all selected options</li>
  190. <li><code>event</code> - the event that initialised the action</li>
  191. <li><code>silent</code> - <code>boolean</code> that tells if you have to trigger <code>beforeMoveToRight</code> and <code>afterMoveToRight</code></li>
  192. <li><code>skipStack</code> - <code>boolean</code> that tells if you have to handle <code>undo/redo</code> stack</li>
  193. </ul>
  194. </td>
  195. </tr>
  196. <tr id="afterMoveToRight">
  197. <td>afterMoveToRight</td>
  198. <td><code>function</code></td>
  199. <td>no action</td>
  200. <td>
  201. 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/>
  202. <code>afterMoveToRight: function($left, $right, $options) { ...; }</code><br/><br/>
  203. <ul>
  204. <li><code>$left</code> - jQuery element pointing to left side <code>select</code> element</li>
  205. <li><code>$right</code> - jQuery element pointing to right side <code>select</code> element</li>
  206. <li><code>$options</code> - jQuery element containing all selected options</li>
  207. </ul>
  208. </td>
  209. </tr>
  210. <tr id="beforeMoveToLeft">
  211. <td>beforeMoveToLeft</td>
  212. <td><code>function</code></td>
  213. <td>return <code>true</code></td>
  214. <td>
  215. 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/>
  216. <code>beforeMoveToLeft: function($left, $right, $options) { ...; return Boolean; }</code>.<br/><br/>
  217. <ul>
  218. <li><code>$left</code> - jQuery element pointing to left side <code>select</code> element</li>
  219. <li><code>$right</code> - jQuery element pointing to right side <code>select</code> element</li>
  220. <li><code>$options</code> - jQuery element containing all selected options</li>
  221. </ul>
  222. Keep in mind that this function must return a boolean value.<br/>
  223. <ul>
  224. <li><code>true</code> will let the action to be performed</li>
  225. <li><code>false</code> will stop the action</li>
  226. </ul>
  227. </td>
  228. </tr>
  229. <tr id="moveToLeft">
  230. <td>moveToLeft</td>
  231. <td><code>function</code></td>
  232. <td>return <code>this</code></td>
  233. <td>
  234. If you want to define your own <code>moveToLeft</code> functionality you can do this by defining<br/><br/>
  235. <code>moveToLeft: function(Multiselect, $options, event, silent, skipStack) { ... }</code><br/><br/>
  236. <ul>
  237. <li><code>Multiselect</code> - current instance of multiselect</li>
  238. <li><code>$options</code> - jQuery element containing all selected options</li>
  239. <li><code>event</code> - the event that initialised the action</li>
  240. <li><code>silent</code> - <code>boolean</code> that tells if you have to trigger <code>beforeMoveToRight</code> and <code>afterMoveToRight</code></li>
  241. <li><code>skipStack</code> - <code>boolean</code> that tells if you have to handle <code>undo/redo</code> stack</li>
  242. </ul>
  243. </td>
  244. </tr>
  245. <tr id="afterMoveToLeft">
  246. <td>afterMoveToLeft</td>
  247. <td><code>function</code></td>
  248. <td>no action</td>
  249. <td>
  250. 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/>
  251. <code>afterMoveToLeft: function($left, $right, $options) { ...; }</code><br/><br/>
  252. <ul>
  253. <li><code>$left</code> - jQuery element pointing to left side <code>select</code> element</li>
  254. <li><code>$right</code> - jQuery element pointing to right side <code>select</code> element</li>
  255. <li><code>$options</code> - jQuery element containing all selected options</li>
  256. </ul>
  257. </td>
  258. </tr>
  259. <tr id="beforeMoveUp">
  260. <td>beforeMoveUp</td>
  261. <td><code>function</code></td>
  262. <td>return <code>true</code></td>
  263. <td>
  264. Whatever you want to do with <code>$options</code> elements before they are moved up.<br/><br/>
  265. <code>beforeMoveUp: function( $options) { ...; return Boolean; }</code>.<br/><br/>
  266. <ul>
  267. <li><code>$options</code> - jQuery element containing all selected options</li>
  268. </ul>
  269. Keep in mind that this function must return a boolean value.<br/>
  270. <ul>
  271. <li><code>true</code> will let the action to be performed</li>
  272. <li><code>false</code> will stop the action</li>
  273. </ul>
  274. </td>
  275. </tr>
  276. <tr id="afterMoveUp">
  277. <td>afterMoveUp</td>
  278. <td><code>function</code></td>
  279. <td>no action</td>
  280. <td>
  281. Whatever you want to do with <code>$options</code> elements after they are moved up.<br/><br/>
  282. <code>afterMoveUp: function($options) { ...; }</code><br/><br/>
  283. <ul>
  284. <li><code>$options</code> - jQuery element containing all selected options</li>
  285. </ul>
  286. </td>
  287. </tr>
  288. <tr id="beforeMoveDown">
  289. <td>beforeMoveDown</td>
  290. <td><code>function</code></td>
  291. <td>return <code>true</code></td>
  292. <td>
  293. Whatever you want to do with <code>$options</code> elements before they are moved down.<br/><br/>
  294. <code>beforeMoveDown: function( $options) { ...; return Boolean; }</code>.<br/><br/>
  295. <ul>
  296. <li><code>$options</code> - jQuery element containing all selected options</li>
  297. </ul>
  298. Keep in mind that this function must return a boolean value.<br/>
  299. <ul>
  300. <li><code>true</code> will let the action to be performed</li>
  301. <li><code>false</code> will stop the action</li>
  302. </ul>
  303. </td>
  304. </tr>
  305. <tr id="afterMoveDown">
  306. <td>afterMoveDown</td>
  307. <td><code>function</code></td>
  308. <td>no action</td>
  309. <td>
  310. Whatever you want to do with <code>$options</code> elements after they are moved down.<br/><br/>
  311. <code>afterMoveDown: function($options) { ...; }</code><br/><br/>
  312. <ul>
  313. <li><code>$options</code> - jQuery element containing all selected options</li>
  314. </ul>
  315. </td>
  316. </tr>
  317. <tr>
  318. <td>keepRenderingSort</td>
  319. <td><code>boolean</code></td>
  320. <td><code>false</code></td>
  321. <td>
  322. When you want to keep options sorted as they was rendered, <code>keepRenderingSort</code> must be <code>true</code>.<br/>
  323. When <code>keepRenderingSort</code> is <code>true</code>, <code>sort</code> function will be ignored.
  324. </td>
  325. </tr>
  326. <tr>
  327. <td>submitAllLeft</td>
  328. <td><code>boolean</code></td>
  329. <td><code>true</code></td>
  330. <td>
  331. When you don&rsquo;t want to send all options from the left side to server, <code>submitAllLeft</code> must be <code>false</code>.
  332. </td>
  333. </tr>
  334. <tr>
  335. <td>submitAllRight</td>
  336. <td><code>boolean</code></td>
  337. <td><code>true</code></td>
  338. <td>
  339. When you don&rsquo;t want to send all options from the right side to server, <code>submitAllRight</code> must be <code>false</code>.
  340. </td>
  341. </tr>
  342. <tr>
  343. <td>search</td>
  344. <td><code>Object</code></td>
  345. <td><code>null</code></td>
  346. <td>
  347. 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/>
  348. <pre class="prettyprint linenums">
  349. search: {
  350. left: &#39;&lt;input type=&quot;text&quot; name=&quot;q&quot; class=&quot;form-control&quot; placeholder=&quot;Search...&quot; /&gt;&#39;,
  351. right: &#39;&lt;input type=&quot;text&quot; name=&quot;q&quot; class=&quot;form-control&quot; placeholder=&quot;Search...&quot; /&gt;&#39;,
  352. }
  353. </pre>
  354. When you want to have search field only for <code>left</code> element you can do this by providing following value:<br/>
  355. <pre class="prettyprint linenums">
  356. search: {
  357. left: &#39;&lt;input type=&quot;text&quot; name=&quot;q&quot; class=&quot;form-control&quot; placeholder=&quot;Search...&quot; /&gt;&#39;,
  358. }
  359. </pre>
  360. </td>
  361. </tr>
  362. <tr id="fireSearch">
  363. <td>fireSearch</td>
  364. <td><code>function</code></td>
  365. <td>return <code>true</code> if search length is great than 1</td>
  366. <td>
  367. Tell to multiselect when to start applying the search.<br/><br/>
  368. <code>fireSearch: function(value) { ...; return Boolean; }</code><br/><br/>
  369. <ul>
  370. <li><code>value</code> - String search entered by the user</li>
  371. </ul>
  372. </td>
  373. </tr>
  374. </tbody>
  375. </table>
  376. </div>
  377. <div id="browser-support">
  378. <div class="page-header"><h3>Browser Support</h3></div>
  379. <h4>The following browsers are supported:</h4>
  380. <ul>
  381. <li>Internet Explorer 7+</li>
  382. <li>Google Chrome</li>
  383. <li>Mozilla Firefox</li>
  384. <li>Safari</li>
  385. <li>Opera</li>
  386. </ul>
  387. </div>
  388. <div id="download">
  389. <div class="page-header"><h3>Download</h3></div>
  390. <div class="row">
  391. <div class="col-xs-4">
  392. <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>
  393. </div>
  394. <div class="col-xs-4">
  395. <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>
  396. </div>
  397. <div class="col-xs-4">
  398. <p><a class="btn btn-lg btn-info" href="https://github.com/crlcu/multiselect/archive/master.zip">Download multiselect.zip</a></p>
  399. </div>
  400. </div>
  401. </div>
  402. </div>
  403. <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
  404. <script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
  405. <script>
  406. (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  407. (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  408. m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  409. })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  410. ga('create', 'UA-39934286-1', 'github.com');
  411. ga('send', 'pageview');
  412. </script>
  413. <script type="text/javascript">
  414. $(document).ready(function() {
  415. // make code pretty
  416. window.prettyPrint && prettyPrint();
  417. if ( window.location.hash ) {
  418. scrollTo(window.location.hash);
  419. }
  420. $('.nav').on('click', 'a.scroll', function(e) {
  421. scrollTo($(this).attr('href'));
  422. });
  423. });
  424. function scrollTo( id ) {
  425. if ( $(id).length ) {
  426. $('html,body').animate({scrollTop: $(id).offset().top - 60},'slow');
  427. }
  428. }
  429. </script>
  430. </body>
  431. </html>