/* * 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", { _init: 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 = $('
').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