Permalink
Browse files

now works along with jQuery 1.4.2 and jQuery UI 1.8

  • Loading branch information...
1 parent bab17f2 commit 5be34d2c2d7545a3f7c241f0f865198ffa3a721e michael committed Apr 12, 2010
View
@@ -1,8 +1,12 @@
-h2. jQuery UI Multiselect Next
+h2. jQuery UI Multiselect Next (now runs on jQuery UI 1.8)
-This is supposed become the final version (1.0) of jQuery UI Multiselect one day ;-).
+This is a more advanced but not well tested extended version of the jQuery UI Multiselect widget.
+It just got updated to work along with jQuery 1.4.2 and jQuery UI 1.8.
-Please visit Yanick's demo page to see the most recent version in action!
+I've installed a demo page at "http://quasipartikel.at/multiselect_ext/":http://quasipartikel.at/multiselect_ext/
+
+-
+For the original version done by Yanick (which is based on jQuery 1.3 and jQuery UI 1.7) please visit his demo page:
"http://yanickrochon.uuuq.com/multiselect/":http://yanickrochon.uuuq.com/multiselect/
View
@@ -6,8 +6,8 @@
<link rel="stylesheet" href="css/common.css" type="text/css" />
<link type="text/css" rel="stylesheet" href="css/themes/smoothness/jquery-ui-1.7.1.custom.css" />
<link type="text/css" href="css/ui.multiselect.css" rel="stylesheet" />
- <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
- <script type="text/javascript" src="js/jquery-ui-1.7.1.custom.min.js"></script>
+ <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
+ <script type="text/javascript" src="js/jquery-ui-1.8.custom.min.js"></script>
<script type="text/javascript" src="js/plugins/localisation/jquery.localisation-min.js"></script>
<script type="text/javascript" src="js/plugins/tmpl/jquery.tmpl.1.1.1.js"></script>
<script type="text/javascript" src="js/plugins/blockUI/jquery.blockUI.js"></script>
@@ -46,14 +46,14 @@
<ul id="nav">
<li><a href="http://quasipartikel.at/2009/05/10/jqueryui-multiselect/">Blogpost</a></li>
<li><a href="http://github.com/michael/multiselect">Source</a></li>
- <li><a href="http://github.com/michael/multiselect/zipball/master">Download</a></li>
+ <li><a href="http://github.com/michael/multiselect/zipball/next">Download</a></li>
<li><a href="http://github.com/michael/multiselect/issues">Bugs</a></li>
</ul>
</div>
<div id="content">
<p>
- It depends on <a href="http://jquery.com/">jQuery 1.3</a> and <a href="http://jqueryui.com/">jQuery UI 1.7</a>.
+ It depends on <a href="http://jquery.com/">jQuery 1.4.2</a> and <a href="http://jqueryui.com/">jQuery UI 1.8</a>.
The widget is styleable using <a href="http://jqueryui.com/themeroller/" title="jQuery UI Themeroller">Themeroller</a>.
It works in an <em>unobtrusive</em> fashion, by just turning html multiple select inputs into a sexier equivalent. There's no extra markup needed.
</p>
Oops, something went wrong.
View
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
No changes.
@@ -14,4 +14,4 @@ $.extend($.ui.multiselect.locale, {
errorInsertNode:"There was a problem trying to add the item:\n\n\t[#{key}] => #{value}\n\nThe operation was aborted.",
errorReadonly:"The option #{option} is readonly",
errorRequest:"Sorry! There seemed to be a problem with the remote call. (Type: #{status})"
-});
+});
View
@@ -3,6 +3,7 @@
*
* @author Yanick Rochon
*/
+
$(function() {
var DEBUG = false; // true for displaying debug information
View
@@ -36,10 +36,66 @@
*/
+/********************************
+ * Default callbacks
+ ********************************/
+
+// expect data to be "val1=text1[\nval2=text2[\n...]]"
+var defaultDataParser = function(data) {
+ if ( typeof data == 'string' ) {
+ var pattern = /^(\s\n\r\t)*\+?$/;
+ var selected, line, lines = data.split(/\n/);
+ data = {};
+ for (var i in lines) {
+ line = lines[i].split("=");
+ // make sure the key is not empty
+ if (!pattern.test(line[0])) {
+ selected = (line[0].lastIndexOf('+') == line.length - 1);
+ if (selected) line[0] = line.substr(0,line.length-1);
+ // if no value is specified, default to the key value
+ data[line[0]] = {
+ selected: false,
+ value: line[1] || line[0]
+ };
+ }
+ }
+ } else {
+ this._messages($.ui.multiselect.constante.MESSAGE_ERROR, $.ui.multiselect.locale.errorDataFormat);
+ data = false;
+ }
+ return data;
+};
+
+var defaultNodeComparator = function(node1,node2) {
+ var text1 = node1.text(),
+ text2 = node2.text();
+ return text1 == text2 ? 0 : (text1 < text2 ? -1 : 1);
+};
+
(function($) {
$.widget("ui.multiselect", {
- _init: function() {
+ options: {
+ // sortable and droppable
+ sortable: 'left',
+ droppable: 'both',
+ // searchable
+ searchable: true,
+ searchDelay: 400,
+ remoteUrl: null,
+ remoteParams: {},
+ // animated
+ animated: 'fast',
+ show: 'slideDown',
+ hide: 'slideUp',
+ // ui
+ dividerLocation: 0.6,
+ // callbacks
+ dataParser: defaultDataParser,
+ nodeComparator: defaultNodeComparator,
+ nodeInserted: null
+ },
+ _create: function() {
this.element.hide();
this.busy = false; // busy state
this.container = $('<div class="ui-multiselect ui-helper-clearfix ui-widget"></div>').insertAfter(this.element);
@@ -817,41 +873,7 @@ var _dragHelper = function(event, ui) {
};
-/********************************
- * Default callbacks
- ********************************/
-
-// expect data to be "val1=text1[\nval2=text2[\n...]]"
-var defaultDataParser = function(data) {
- if ( typeof data == 'string' ) {
- var pattern = /^(\s\n\r\t)*\+?$/;
- var selected, line, lines = data.split(/\n/);
- data = {};
- for (var i in lines) {
- line = lines[i].split("=");
- // make sure the key is not empty
- if (!pattern.test(line[0])) {
- selected = (line[0].lastIndexOf('+') == line.length - 1);
- if (selected) line[0] = line.substr(0,line.length-1);
- // if no value is specified, default to the key value
- data[line[0]] = {
- selected: false,
- value: line[1] || line[0]
- };
- }
- }
- } else {
- this._messages($.ui.multiselect.constante.MESSAGE_ERROR, $.ui.multiselect.locale.errorDataFormat);
- data = false;
- }
- return data;
-};
-var defaultNodeComparator = function(node1,node2) {
- var text1 = node1.text(),
- text2 = node2.text();
- return text1 == text2 ? 0 : (text1 < text2 ? -1 : 1);
-};
/****************************
@@ -860,26 +882,6 @@ var defaultNodeComparator = function(node1,node2) {
$.extend($.ui.multiselect, {
getter: 'selectedValues enabled isBusy',
- defaults: {
- // sortable and droppable
- sortable: 'left',
- droppable: 'both',
- // searchable
- searchable: true,
- searchDelay: 400,
- remoteUrl: null,
- remoteParams: {},
- // animated
- animated: 'fast',
- show: 'slideDown',
- hide: 'slideUp',
- // ui
- dividerLocation: 0.6,
- // callbacks
- dataParser: defaultDataParser,
- nodeComparator: defaultNodeComparator,
- nodeInserted: null
- },
locale: {
addAll:'Add all',
removeAll:'Remove all',

0 comments on commit 5be34d2

Please sign in to comment.