Skip to content

Commit

Permalink
Update example for custom options.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Kelley committed Apr 15, 2015
1 parent 3539a13 commit 793ed09
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions examples/typeahead-custom-options.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ <h1>Topcoat + React.Typeahead (custom options)</h1>
<script type="text/jsx">
/** @jsx React.DOM */

var getSearchString = function(option) {
return option.firstName + " " + option.lastName;
};
var getDisplayString = function(option) {
return option.firstName + " (" + option.birthYear + ")";
};
var options = [
{
firstName: 'John',
Expand All @@ -71,15 +65,22 @@ <h1>Topcoat + React.Typeahead (custom options)</h1>
lastName: 'Starr',
birthYear: 1940
}
];
].map(function(option) {
option.fullName = option.firstName + ' ' + option.lastName;
return option;
});

var displayOption = function(option) {
return option.firstName + " (" + option.birthYear + ")";
};

window.onload = function() {
React.render(
<ReactTypeahead.Typeahead
defaultValue="a"
options={options}
getSearchString={getSearchString}
getDisplayString={getDisplayString}
filterOption='fullName'
displayOption={ displayOption }
className="topcoat-list"
customClasses={{
input: "topcoat-text-input",
Expand Down

0 comments on commit 793ed09

Please sign in to comment.