{"action":"created","issue":{"url":"https://api.github.com/repos/LeaVerou/awesomplete/issues/16852","repository_url":"https://api.github.com/repos/LeaVerou/awesomplete","labels_url":"https://api.github.com/repos/LeaVerou/awesomplete/issues/16852/labels{/name}","comments_url":"https://api.github.com/repos/LeaVerou/awesomplete/issues/16852/comments","events_url":"https://api.github.com/repos/LeaVerou/awesomplete/issues/16852/events","html_url":"https://github.com/LeaVerou/awesomplete/pull/16852","id":132682639,"number":16852,"title":"Separate label/value for each suggestion in list.","user":{"login":"vlazar","id":7262,"avatar_url":"https://avatars.githubusercontent.com/u/7262?v=3","gravatar_id":"","url":"https://api.github.com/users/vlazar","html_url":"https://github.com/vlazar","followers_url":"https://api.github.com/users/vlazar/followers","following_url":"https://api.github.com/users/vlazar/following{/other_user}","gists_url":"https://api.github.com/users/vlazar/gists{/gist_id}","starred_url":"https://api.github.com/users/vlazar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vlazar/subscriptions","organizations_url":"https://api.github.com/users/vlazar/orgs","repos_url":"https://api.github.com/users/vlazar/repos","events_url":"https://api.github.com/users/vlazar/events{/privacy}","received_events_url":"https://api.github.com/users/vlazar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2016-02-10T12:13:28Z","updated_at":"2016-02-15T10:33:37Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/LeaVerou/awesomplete/pulls/16852","html_url":"https://github.com/LeaVerou/awesomplete/pull/16852","diff_url":"https://github.com/LeaVerou/awesomplete/pull/16852.diff","patch_url":"https://github.com/LeaVerou/awesomplete/pull/16852.patch"},"body":"It is now possible to show a suggestion label in completer, but insert a suggestion value into the input instead.\r\n\r\nIn addition to String as before, each list item now can also be:\r\n- a `{ label, value }` Object\r\n- a `[ label, value ]` Array\r\n\r\nTo show full country name in completer, but insert country code into the input you can use these items:\r\n- `{ label: \"United States\", value: \"US\" }`\r\n- `[ \"United States\", \"US\" ]`\r\n\r\nDespite this data format change, old code will continue to work as before. This is taken care by `Suggestion()`. It uses `label` property automatically when string is expected anywhere in the API.\r\n\r\nIn addition to default support for String/Object/Array items, we also add `data` method, which can be used to support any additional custom item formats and to generate data dynamically, as in changed Email example. The only thing you need to do in this case is to return item in any of String/Array/Object formats supported by default."},"comment":{"url":"https://api.github.com/repos/LeaVerou/awesomplete/issues/comments/184157321","html_url":"https://github.com/LeaVerou/awesomplete/pull/16852#issuecomment-184157321","issue_url":"https://api.github.com/repos/LeaVerou/awesomplete/issues/16852","id":184157321,"user":{"login":"vlazar","id":7262,"avatar_url":"https://avatars.githubusercontent.com/u/7262?v=3","gravatar_id":"","url":"https://api.github.com/users/vlazar","html_url":"https://github.com/vlazar","followers_url":"https://api.github.com/users/vlazar/followers","following_url":"https://api.github.com/users/vlazar/following{/other_user}","gists_url":"https://api.github.com/users/vlazar/gists{/gist_id}","starred_url":"https://api.github.com/users/vlazar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vlazar/subscriptions","organizations_url":"https://api.github.com/users/vlazar/orgs","repos_url":"https://api.github.com/users/vlazar/repos","events_url":"https://api.github.com/users/vlazar/events{/privacy}","received_events_url":"https://api.github.com/users/vlazar/received_events","type":"User","site_admin":false},"created_at":"2016-02-15T10:33:37Z","updated_at":"2016-02-15T10:33:37Z","body":"> Also, once we finalize the design, it might be a good idea to have a few people test this out in real use cases before we deploy. Maybe we should first add it as a separate branch and ping those who requested it to try it out? Just a thought. What do you think?\r\n\r\nI was planning to make sure everything, including all the old examples and suggested features, will work before accepting this PR as LGTM by myself, but sure, we can ask others to check this out as well. Don't know how many will bother to check it though. It might have been easier with continuous npm releases."}}