Skip to content

Commit

Permalink
Support function for lookup column construction. (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsweaters authored Jul 23, 2016
1 parent e6e1668 commit bca5765
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 13 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Collection object shown with defaults:
// specify an alternative parent container for the menu
menuContainer: document.body,

// column to search against in the object
// column to search against in the object (accepts function or string)
lookup: 'key',

// column that contains the content to insert by default
Expand All @@ -129,6 +129,16 @@ Collection object shown with defaults:
}
```

The `lookup` column can also be passed a function to construct a string to query against. This is useful if your payload has multiple attributes that you would like to query against but you can't modify the payload returned from the server to include a concatenated lookup column.

```js
{
lookup: function (person) {
return person.name + person.email;
}
}
```

### Template Item
Both the `selectTemplate` and the `menuItemTemplate` have access to the `item` object. This is a meta object containing the matched object from your values collection, wrapped in a search result.

Expand Down
51 changes: 42 additions & 9 deletions dist/tribute.js

Large diffs are not rendered by default.

Loading

0 comments on commit bca5765

Please sign in to comment.