{"action":"created","issue":{"url":"https://api.github.com/repos/corejavascript/typeahead.js/issues/56","labels_url":"https://api.github.com/repos/corejavascript/typeahead.js/issues/56/labels{/name}","comments_url":"https://api.github.com/repos/corejavascript/typeahead.js/issues/56/comments","events_url":"https://api.github.com/repos/corejavascript/typeahead.js/issues/56/events","html_url":"https://github.com/corejavascript/typeahead.js/issues/56","id":128533003,"number":56,"title":"How to get id and value on event trigger?","user":{"login":"Locustv2","id":4509909,"avatar_url":"https://avatars.githubusercontent.com/u/4509909?v=3","gravatar_id":"","url":"https://api.github.com/users/Locustv2","html_url":"https://github.com/Locustv2","followers_url":"https://api.github.com/users/Locustv2/followers","following_url":"https://api.github.com/users/Locustv2/following{/other_user}","gists_url":"https://api.github.com/users/Locustv2/gists{/gist_id}","starred_url":"https://api.github.com/users/Locustv2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Locustv2/subscriptions","organizations_url":"https://api.github.com/users/Locustv2/orgs","repos_url":"https://api.github.com/users/Locustv2/repos","events_url":"https://api.github.com/users/Locustv2/events{/privacy}","received_events_url":"https://api.github.com/users/Locustv2/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-25T13:04:47Z","updated_at":"2016-01-28T22:25:00Z","closed_at":null,"body":"My json:\r\n\r\n```json\r\n[\r\n    {id:1, name:'paul'}, \r\n    {id:2, name:'jim'}, \r\n    {id:3, name:'tom'}, \r\n    {id:4, name:'medor'}, \r\n    {id:5, name:'janzy'}\r\n]\r\n```\r\n\r\ninstance:\r\n```javascript\r\nvar bh = new Bloodhound({\r\n    datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),\r\n    queryTokenizer: Bloodhound.tokenizers.whitespace,\r\n    prefetch: '//localhost/data/names.json',\r\n    identify: function(datum){\r\n        return datum.id;    \r\n    }\r\n});\r\n\r\n$('#name').typeahead({\"highlight\":true}, {\r\n    \"name\":\"name\",\r\n    \"source\":bh,\r\n    \"display\":\"value\",\r\n    \"limit\":10\r\n})\r\n```\r\n\r\nevent triggers:\r\n```javascript\r\n$('#name').bind('typeahead:select', function(ev, suggestion){\r\n    console.log(suggestion);\r\n})\r\n```\r\n\r\n`suggestion` is an object which contain only the text value (i.e. name). How do i obtain the id?"},"comment":{"url":"https://api.github.com/repos/corejavascript/typeahead.js/issues/comments/176452001","html_url":"https://github.com/corejavascript/typeahead.js/issues/56#issuecomment-176452001","issue_url":"https://api.github.com/repos/corejavascript/typeahead.js/issues/56","id":176452001,"user":{"login":"unclescooby","id":16882732,"avatar_url":"https://avatars.githubusercontent.com/u/16882732?v=3","gravatar_id":"","url":"https://api.github.com/users/unclescooby","html_url":"https://github.com/unclescooby","followers_url":"https://api.github.com/users/unclescooby/followers","following_url":"https://api.github.com/users/unclescooby/following{/other_user}","gists_url":"https://api.github.com/users/unclescooby/gists{/gist_id}","starred_url":"https://api.github.com/users/unclescooby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unclescooby/subscriptions","organizations_url":"https://api.github.com/users/unclescooby/orgs","repos_url":"https://api.github.com/users/unclescooby/repos","events_url":"https://api.github.com/users/unclescooby/events{/privacy}","received_events_url":"https://api.github.com/users/unclescooby/received_events","type":"User","site_admin":false},"created_at":"2016-01-28T22:25:00Z","updated_at":"2016-01-28T22:25:00Z","body":"I'd say:\r\n\r\n    console.log(suggestion.id);\r\n\r\n\r\nYou'll probably need to define a template or set the display to make things work properly.\r\n\r\n     \"display\":\"name\",\r\n"}}