{"action":"created","issue":{"url":"https://api.github.com/repos/select2/select2/issues/3497","labels_url":"https://api.github.com/repos/select2/select2/issues/3497/labels{/name}","comments_url":"https://api.github.com/repos/select2/select2/issues/3497/comments","events_url":"https://api.github.com/repos/select2/select2/issues/3497/events","html_url":"https://github.com/select2/select2/issues/3497","id":89495575,"number":3497,"title":"select2 4.0: allowClear gives js-error when used on single select boxes with ajax load","user":{"login":"RabenErland","id":4486504,"avatar_url":"https://avatars.githubusercontent.com/u/4486504?v=3","gravatar_id":"","url":"https://api.github.com/users/RabenErland","html_url":"https://github.com/RabenErland","followers_url":"https://api.github.com/users/RabenErland/followers","following_url":"https://api.github.com/users/RabenErland/following{/other_user}","gists_url":"https://api.github.com/users/RabenErland/gists{/gist_id}","starred_url":"https://api.github.com/users/RabenErland/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RabenErland/subscriptions","organizations_url":"https://api.github.com/users/RabenErland/orgs","repos_url":"https://api.github.com/users/RabenErland/repos","events_url":"https://api.github.com/users/RabenErland/events{/privacy}","received_events_url":"https://api.github.com/users/RabenErland/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/select2/select2/labels/4.x","name":"4.x","color":"c7def8"},{"url":"https://api.github.com/repos/select2/select2/labels/needs%20information","name":"needs information","color":"bfe5bf"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-06-19T07:45:28Z","updated_at":"2015-07-27T17:08:43Z","closed_at":"2015-07-27T17:08:43Z","body":"We are using ajax to load data remotely to a single select box. It works just fine, but if allowClear is enabled (set to true) a javascript error is encountered in select2 when the clear mark is clicked in the select box - and the value is not cleared from the box.\r\n\r\nThe error is:\r\nUncaught TypeError: Cannot read property 'id' of undefined\r\nS2.define.AllowClear._handleClear @ select2.js:1721\r\nS2.define.Utils.Decorate.calledMethod @ select2.js:571\r\n(anonymous function) @ select2.js:1681\r\nn.event.dispatch @ jquery-2.1.4.min.js:3\r\nn.event.add.r.handle @ jquery-2.1.4.min.js:3"},"comment":{"url":"https://api.github.com/repos/select2/select2/issues/comments/125274407","html_url":"https://github.com/select2/select2/issues/3497#issuecomment-125274407","issue_url":"https://api.github.com/repos/select2/select2/issues/3497","id":125274407,"user":{"login":"kevin-brown","id":1991850,"avatar_url":"https://avatars.githubusercontent.com/u/1991850?v=3","gravatar_id":"","url":"https://api.github.com/users/kevin-brown","html_url":"https://github.com/kevin-brown","followers_url":"https://api.github.com/users/kevin-brown/followers","following_url":"https://api.github.com/users/kevin-brown/following{/other_user}","gists_url":"https://api.github.com/users/kevin-brown/gists{/gist_id}","starred_url":"https://api.github.com/users/kevin-brown/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevin-brown/subscriptions","organizations_url":"https://api.github.com/users/kevin-brown/orgs","repos_url":"https://api.github.com/users/kevin-brown/repos","events_url":"https://api.github.com/users/kevin-brown/events{/privacy}","received_events_url":"https://api.github.com/users/kevin-brown/received_events","type":"User","site_admin":false},"created_at":"2015-07-27T17:08:43Z","updated_at":"2015-07-27T17:08:43Z","body":"This is a duplicate of https://github.com/select2/select2/issues/3016, you can see the error if you add `debug: true`."}}