Skip to content
Browse files

Compiled updates

  • Loading branch information...
1 parent 25393ad commit 3fb092ffc10f95699843d6bd000a0f86e830ab0f @meltingice committed Jun 16, 2012
Showing with 5 additions and 1 deletion.
  1. +3 −0 lib/ajax-chosen.js
  2. +2 −1 lib/ajax-chosen.min.js
View
3 lib/ajax-chosen.js
@@ -39,6 +39,9 @@
options.data = {};
}
options.data[options.jsonTermKey] = val;
+ if (options.dataCallback != null) {
+ options.data = options.dataCallback(options.data);
+ }
success = options.success;
options.success = function(data) {
var items, selected_values;
View
3 lib/ajax-chosen.min.js
@@ -5,7 +5,8 @@ defaultOptions={minTermLength:3,afterTypeDelay:500,jsonTermKey:"term"};select=th
$(this).data('prevVal',val);if(this.timer){clearTimeout(this.timer);}
if(val.length<options.minTermLength){return false;}
field=$(this);if(!(options.data!=null)){options.data={};}
-options.data[options.jsonTermKey]=val;success=options.success;options.success=function(data){var items,selected_values;if(!(data!=null)){return;}
+options.data[options.jsonTermKey]=val;if(options.dataCallback!=null){options.data=options.dataCallback(options.data);}
+success=options.success;options.success=function(data){var items,selected_values;if(!(data!=null)){return;}
selected_values=[];select.find('option').each(function(){if(!$(this).is(":selected")){return $(this).remove();}else{return selected_values.push($(this).val()+"-"+$(this).text());}});items=callback(data);$.each(items,function(value,text){if($.inArray(value+"-"+text,selected_values)===-1){return $("<option />").attr('value',value).html(text).appendTo(select);}});select.trigger("liszt:updated");if(success!=null){success(data);}
field.attr('value',val);return field.css('width','auto');};return this.timer=setTimeout(function(){if(chosenXhr){chosenXhr.abort();}
return chosenXhr=$.ajax(options);},options.afterTypeDelay);});});};})(jQuery);

0 comments on commit 3fb092f

Please sign in to comment.
Something went wrong with that request. Please try again.