{"action":"created","issue":{"url":"https://api.github.com/repos/brianreavis/selectize.js/issues/693","labels_url":"https://api.github.com/repos/brianreavis/selectize.js/issues/693/labels{/name}","comments_url":"https://api.github.com/repos/brianreavis/selectize.js/issues/693/comments","events_url":"https://api.github.com/repos/brianreavis/selectize.js/issues/693/events","html_url":"https://github.com/brianreavis/selectize.js/issues/693","id":55743919,"number":693,"title":"New values (not in options) are not rendered from initial val when create:true","user":{"login":"stevelacey","id":289531,"avatar_url":"https://avatars.githubusercontent.com/u/289531?v=3","gravatar_id":"","url":"https://api.github.com/users/stevelacey","html_url":"https://github.com/stevelacey","followers_url":"https://api.github.com/users/stevelacey/followers","following_url":"https://api.github.com/users/stevelacey/following{/other_user}","gists_url":"https://api.github.com/users/stevelacey/gists{/gist_id}","starred_url":"https://api.github.com/users/stevelacey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevelacey/subscriptions","organizations_url":"https://api.github.com/users/stevelacey/orgs","repos_url":"https://api.github.com/users/stevelacey/repos","events_url":"https://api.github.com/users/stevelacey/events{/privacy}","received_events_url":"https://api.github.com/users/stevelacey/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-01-28T11:21:35Z","updated_at":"2015-01-28T12:51:26Z","closed_at":null,"body":"When using the setting `create: true`, you can add new values not present in options just fine, but if the initial value of the input included a new value – it is stripped when the initial options for the text box are rendered.\r\n\r\nI can't pinpoint where this is happening, or how to mitigate it, but isn't this unexpected behaviour anyway?\r\n\r\nSurely I am not meant to parse the initial value and slot new values into the options array? My use case is a tags field, where creating new tags is cool, but encouraging the reuse of existing tags is important, loading non-existant tags into the options seems a bit nonsensical."},"comment":{"url":"https://api.github.com/repos/brianreavis/selectize.js/issues/comments/71829999","html_url":"https://github.com/brianreavis/selectize.js/issues/693#issuecomment-71829999","issue_url":"https://api.github.com/repos/brianreavis/selectize.js/issues/693","id":71829999,"user":{"login":"brianreavis","id":118480,"avatar_url":"https://avatars.githubusercontent.com/u/118480?v=3","gravatar_id":"","url":"https://api.github.com/users/brianreavis","html_url":"https://github.com/brianreavis","followers_url":"https://api.github.com/users/brianreavis/followers","following_url":"https://api.github.com/users/brianreavis/following{/other_user}","gists_url":"https://api.github.com/users/brianreavis/gists{/gist_id}","starred_url":"https://api.github.com/users/brianreavis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianreavis/subscriptions","organizations_url":"https://api.github.com/users/brianreavis/orgs","repos_url":"https://api.github.com/users/brianreavis/repos","events_url":"https://api.github.com/users/brianreavis/events{/privacy}","received_events_url":"https://api.github.com/users/brianreavis/received_events","type":"User","site_admin":false},"created_at":"2015-01-28T12:51:26Z","updated_at":"2015-01-28T12:51:26Z","body":"Ah, I get what you're saying now. Selectize *could* call `create` for any undeclared options upon initialization, but I feel like that would open up more edge cases / strange behavior (especially when async). I'll need to think on it – I'd suggest this for now: http://jsfiddle.net/rgybvjk1/\r\n```js\r\nvar $input = $('input');\r\nvar tags = $input.val().split(/\\s*,\\s*/);\r\n\r\n$input.selectize({\r\n    create: true,\r\n    options: [{item: 'hello'}],\r\n    labelField:  'item',\r\n    valueField:  'item',\r\n    sortField:   'item',\r\n    searchField: 'item'\r\n});\r\n\r\n// create any custom tags that don't exist in the pre-defined pool of options\r\nvar selectize = $input[0].selectize;\r\nfor (var i = 0, n = tags.length; i < n; i++) {\r\n    selectize.addOption({item: tags[i]});\r\n}\r\nselectize.setValue(tags);\r\n```"}}