Permalink
Browse files

Store data on token now correctly works with new propertyToSearch opt…

…ion. Should Token data attributes include all attributes from the returned JSON object or only 'id' and the propertyToSearch
  • Loading branch information...
1 parent 4d0d07b commit 77910d1df1cdf36654b1a694df81ed049ebd2f68 @malandrew committed Jul 28, 2011
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/jquery.tokeninput.js
@@ -11,7 +11,7 @@
(function ($) {
// Default settings
var DEFAULT_SETTINGS = {
- propertyToSearch: "name",
+ propertyToSearch: "first_name",
hintText: "Type in a search term",
noResultsText: "No results",
searchingText: "Searching...",
@@ -431,7 +431,8 @@ $.TokenList = function (input, url_or_data, settings) {
});
// Store data on the token
- var token_data = {"id": item.id, "name": item[settings.propertyToSearch]};
+ var token_data = {"id": item.id};
+ token_data[settings.propertyToSearch] = item[settings.propertyToSearch];
$.data(this_token.get(0), "tokeninput", item);
// Save this token for duplicate checking

0 comments on commit 77910d1

Please sign in to comment.