From 7a6802194e005b2cca2b9e407e39327a42df70a6 Mon Sep 17 00:00:00 2001 From: kccarter76 Date: Mon, 21 Apr 2014 11:11:19 -0600 Subject: [PATCH 01/12] Update ui.multiselect.js Added the ability to set the height either by option or for the multi select to discover the height of the container that it is rendering in and accounting the height of sibling elements. --- js/ui.multiselect.js | 681 ++++++++++++++++++++++--------------------- 1 file changed, 350 insertions(+), 331 deletions(-) diff --git a/js/ui.multiselect.js b/js/ui.multiselect.js index 3f653d8..0e2548e 100755 --- a/js/ui.multiselect.js +++ b/js/ui.multiselect.js @@ -1,342 +1,361 @@ /* - * jQuery UI Multiselect - * - * Authors: - * Michael Aufreiter (quasipartikel.at) - * Yanick Rochon (yanick.rochon[at]gmail[dot]com) - * - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. - * - * http://www.quasipartikel.at/multiselect/ - * - * - * Depends: - * ui.core.js - * ui.sortable.js - * - * Optional: - * localization (http://plugins.jquery.com/project/localisation) - * scrollTo (http://plugins.jquery.com/project/ScrollTo) - * - * Todo: - * Make batch actions faster - * Implement dynamic insertion through remote calls - */ - - -(function($) { - -$.widget("ui.multiselect", { - options: { - sortable: true, - searchable: true, - doubleClickable: true, - animated: 'fast', - show: 'slideDown', - hide: 'slideUp', - dividerLocation: 0.6, - availableFirst: false, - nodeComparator: function(node1,node2) { - var text1 = node1.text(), +* jQuery UI Multiselect +* +* Authors: +* Michael Aufreiter (quasipartikel.at) +* Yanick Rochon (yanick.rochon[at]gmail[dot]com) +* +* Dual licensed under the MIT (MIT-LICENSE.txt) +* and GPL (GPL-LICENSE.txt) licenses. +* +* http://www.quasipartikel.at/multiselect/ +* +* +* Depends: +* ui.core.js +* ui.sortable.js +* +* Optional: +* localization (http://plugins.jquery.com/project/localisation) +* scrollTo (http://plugins.jquery.com/project/ScrollTo) +* +* Todo: +* Make batch actions faster +* Implement dynamic insertion through remote calls +*/ + + + +(function ($) { + + $.widget("tb.multiselect", { + options: { + height: 'auto', + sortable: true, + searchable: true, + doubleClickable: true, + animated: 'fast', + show: 'slideDown', + hide: 'slideUp', + dividerLocation: 0.6, + availableFirst: false, + nodeComparator: function (node1, node2) { + var text1 = node1.text(), text2 = node2.text(); - return text1 == text2 ? 0 : (text1 < text2 ? -1 : 1); - } - }, - _create: function() { - this.element.hide(); - this.id = this.element.attr("id"); - this.container = $('
').insertAfter(this.element); - this.count = 0; // number of currently selected options - this.selectedContainer = $('
').appendTo(this.container); - this.availableContainer = $('
')[this.options.availableFirst?'prependTo': 'appendTo'](this.container); - this.selectedActions = $('
0 '+$.ui.multiselect.locale.itemsCount+''+$.ui.multiselect.locale.removeAll+'
').appendTo(this.selectedContainer); - this.availableActions = $('
'+$.ui.multiselect.locale.addAll+'
').appendTo(this.availableContainer); - this.selectedList = $('').bind('selectstart', function(){return false;}).appendTo(this.selectedContainer); - this.availableList = $('').bind('selectstart', function(){return false;}).appendTo(this.availableContainer); - - var that = this; - - // set dimensions - this.container.width(this.element.width()+1); - this.selectedContainer.width(Math.floor(this.element.width()*this.options.dividerLocation)); - this.availableContainer.width(Math.floor(this.element.width()*(1-this.options.dividerLocation))); - - // fix list height to match