diff --git a/dist/dual-list-box.js b/dist/dual-list-box.js index 5fdf03f..3612c72 100644 --- a/dist/dual-list-box.js +++ b/dist/dual-list-box.js @@ -58,7 +58,7 @@ if (item === undefined || item === null) { throw 'DualListBox: ' + i + ' is undefined.'; } }); - options['parent'] = 'dual-list-box-' + options.title; + options['parent'] = 'dual-list-box-' + options.title.split(' ').join('-'); options['parentElement'] = '#' + options.parent; selected = $.extend([{}], selected); diff --git a/dist/dual-list-box.min.js b/dist/dual-list-box.min.js index 6de2806..884d5c9 100644 --- a/dist/dual-list-box.min.js +++ b/dist/dual-list-box.min.js @@ -1 +1 @@ -(function($){$.fn.DualListBox=function(paramOptions,selected){return this.each(function(){var defaults={element:$(this).context,uri:"local.json",value:"id",text:"name",title:"Example",json:true,timeout:500,horizontal:false,textLength:45,moveAllBtn:true,maxAllBtn:500,selectClass:"form-control",warning:"Are you sure you want to move this many items? Doing so can cause your browser to become unresponsive."};var htmlOptions={element:$(this).context,uri:$(this).data("source"),value:$(this).data("value"),text:$(this).data("text"),title:$(this).data("title"),json:$(this).data("json"),timeout:$(this).data("timeout"),horizontal:$(this).data("horizontal"),textLength:$(this).data("textLength"),moveAllBtn:$(this).data("moveAllBtn"),maxAllBtn:$(this).data("maxAllBtn"),selectClass:$(this).data("selectClass")};var options=$.extend({},defaults,htmlOptions,paramOptions);$.each(options,function(i,item){if(item===undefined||item===null){throw"DualListBox: "+i+" is undefined."}});options["parent"]="dual-list-box-"+options.title;options["parentElement"]="#"+options.parent;selected=$.extend([{}],selected);if(options.json){addElementsViaJSON(options,selected)}else{construct(options)}})};function addElementsViaJSON(options,selected){var multipleTextFields=false;if(options.text.indexOf(":")>-1){var textToUse=options.text.split(":");if(textToUse.length>1){multipleTextFields=true}}$.getJSON(options.uri,function(json){$.each(json,function(key,item){var text="";if(multipleTextFields){textToUse.forEach(function(entry){text+=item[entry]+" "})}else{text=item[options.text]}$("