Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added the result_converter option

  • Loading branch information...
commit ac047568ba93fcd0b0d225700d4ebf095ad4b88c 1 parent 1566ca2
@rfletcher authored
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/lib/Tagbox.js
View
7 src/lib/Tagbox.js
@@ -53,6 +53,9 @@ var Tagbox = Class.create( {
* minimum_chars_for_autocomplete (Number) = 0:
* The number of characters a user must enter before they're shown
* autocomplete results.
+ * result_converter (Function) = null:
+ * A function which converts a matching result into a format acceptable
+ * to the Tagbox.Tag constructor.
* show_remove_links (Boolean) = false:
* Add an 'x' link to each tag.
* validation_function (Function | null) = null:
@@ -75,6 +78,7 @@ var Tagbox = Class.create( {
hint_delay: 100,
max_tags: null,
minimum_chars_for_autocomplete: 0,
+ result_converter: null,
show_remove_links: true,
validation_function: null
},
@@ -482,6 +486,9 @@ var Tagbox = Class.create( {
**/
objectToTag: function( object ) {
if( ! ( object instanceof Tagbox.Tag ) ) {
+ if( typeof this.options.get( 'result_converter' ) == "function" ) {
+ object = this.options.get( 'result_converter' )( object );
+ }
return new Tagbox.Tag( this, object );
}
return object;
Please sign in to comment.
Something went wrong with that request. Please try again.