diff --git a/contributed/jquery.jeditable.ui-autocomplete.htm b/contributed/jquery.jeditable.ui-autocomplete.htm new file mode 100644 index 0000000..91670e9 --- /dev/null +++ b/contributed/jquery.jeditable.ui-autocomplete.htm @@ -0,0 +1,35 @@ +/* Autocomplete using jQueryUI1.8.16 [from rezeusor with love]*/ +/* This additional code needs to be inserted in your page for the multicomplete to work smoothly */ + + +function split( val ) { + return val.split( /,\s*/ ); +} +function extractLast( term ) { + return split( term ).pop(); +} +var listofstuff = ["0118","999","88199","9119","725","3"] ; +$('.importantNumbers').editable(function(value,settings){return save(this.id,value,this.revert);}, + {type:"autocomplete",autocomplete:{ + minLength: 0, + source: function( request, response ) { + response( $.ui.autocomplete.filter( analysts, extractLast( request.term ) ) ); + }, + focus: function() { + return false; + }, + select: function( event, ui ) { + var terms = split( this.value ); + terms.pop(); + terms.push( ui.item.value ); + terms.push( "" ); + // Set this to whatever you want to be + this.value = terms.join( ", " ); + return false; + } + }, + submit:'save', + cancel:'cancel', + onblur:'ignore' + } +); diff --git a/contributed/jquery.jeditable.ui-autocomplete.js b/contributed/jquery.jeditable.ui-autocomplete.js new file mode 100644 index 0000000..62111c4 --- /dev/null +++ b/contributed/jquery.jeditable.ui-autocomplete.js @@ -0,0 +1,21 @@ +/* Autocomplete using jQueryUI1.8.16 [from rezeusor with love] */ + +//Normal Autocomplete +$.editable.addInputType('autocomplete', { + element : $.editable.types.text.element, + plugin : function(settings, original) { + $('input', this).autocomplete(settings.autocomplete); + } +}); + +//Multiple Results Autocomplete +$.editable.addInputType('multicomplete', { + element : $.editable.types.text.element, + plugin : function(settings, original) { + $('input', this).bind( "keydown", function( event ) { + if ( event.keyCode === $.ui.keyCode.TAB && $( this ).data( "autocomplete" ).menu.active ) { + event.preventDefault(); + } + }).autocomplete(settings.autocomplete); + } +});