{"action":"closed","issue":{"url":"https://api.github.com/repos/jshjohnson/Choices/issues/440","repository_url":"https://api.github.com/repos/jshjohnson/Choices","labels_url":"https://api.github.com/repos/jshjohnson/Choices/issues/440/labels{/name}","comments_url":"https://api.github.com/repos/jshjohnson/Choices/issues/440/comments","events_url":"https://api.github.com/repos/jshjohnson/Choices/issues/440/events","html_url":"https://github.com/jshjohnson/Choices/issues/440","id":364396604,"node_id":"MDU6SXNzdWUzNjQzOTY2MDQ=","number":440,"title":"Choices with \"selected\" attribute do not trigger \"addItem\" event - v3.0.4","user":{"login":"Tahira-Farid","id":28342283,"node_id":"MDQ6VXNlcjI4MzQyMjgz","avatar_url":"https://avatars0.githubusercontent.com/u/28342283?v=4","gravatar_id":"","url":"https://api.github.com/users/Tahira-Farid","html_url":"https://github.com/Tahira-Farid","followers_url":"https://api.github.com/users/Tahira-Farid/followers","following_url":"https://api.github.com/users/Tahira-Farid/following{/other_user}","gists_url":"https://api.github.com/users/Tahira-Farid/gists{/gist_id}","starred_url":"https://api.github.com/users/Tahira-Farid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tahira-Farid/subscriptions","organizations_url":"https://api.github.com/users/Tahira-Farid/orgs","repos_url":"https://api.github.com/users/Tahira-Farid/repos","events_url":"https://api.github.com/users/Tahira-Farid/events{/privacy}","received_events_url":"https://api.github.com/users/Tahira-Farid/received_events","type":"User","site_admin":false},"labels":[{"id":341979943,"node_id":"MDU6TGFiZWwzNDE5Nzk5NDM=","url":"https://api.github.com/repos/jshjohnson/Choices/labels/stale","name":"stale","color":"5319e7","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-09-27T10:01:10Z","updated_at":"2019-01-03T11:22:06Z","closed_at":"2019-01-03T11:22:06Z","author_association":"NONE","body":"I have recently updated all the Choices instances in the platform from v2.5.1 to v3.0.4. I have noticed that in the latest versions when a choice is pre-selected with selected: true at the point of initiation, it no longer triggers the event \"addItem\". For me I think this is a loss of functionality as in most cases I write the callback functionalities as a result of a choice being selected in the \"addItem\" event. \r\nIs there an alternative event can detect pre-selected choices that I should use instead? \r\n\r\n`\r\n\r\n                                 let my = this;\r\n                                      new Choices(this, {\r\n                                          search: false,\r\n                                          callbackOnInit: function () {\r\n                                              let choicesArray = [];\r\n                                              let selected = false;\r\n                                              my.connectionTypes.forEach((type) => {\r\n                                                  // If connectionType is set as default we pre-select it\r\n                                                  selected = type.default\r\n\r\n                                                 let choice = { value: type.sso.toString(), label: my.translateItem(type.name_libelle.translations), selected: selected };\r\n                                                 choicesArray.push(choice);\r\n                                             });\r\n\r\n                                             this.setChoices(choicesArray, 'value', 'label', 'selected', false);\r\n                                            \r\n                                             // Add event listener for when a choice is selected\r\n                                             this.passedElement.addEventListener('addItem', function(event) {\r\n                                                  // When choice is selected update is_sso value\r\n                                                  my.is_sso = event.detail.value;\r\n                                             });\r\n                                        }\r\n                                   });\r\n\r\n\r\n`"}}
{"actor":{"display_login":"stale"}}