{"action":"opened","issue":{"url":"https://api.github.com/repos/ApiO/jquery.buchette/issues/1","labels_url":"https://api.github.com/repos/ApiO/jquery.buchette/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/ApiO/jquery.buchette/issues/1/comments","events_url":"https://api.github.com/repos/ApiO/jquery.buchette/issues/1/events","html_url":"https://github.com/ApiO/jquery.buchette/issues/1","id":130713324,"number":1,"title":"Change execution order in initializeBuchetteArea(element) method","user":{"login":"paysan58","id":17027981,"avatar_url":"https://avatars.githubusercontent.com/u/17027981?v=3","gravatar_id":"","url":"https://api.github.com/users/paysan58","html_url":"https://github.com/paysan58","followers_url":"https://api.github.com/users/paysan58/followers","following_url":"https://api.github.com/users/paysan58/following{/other_user}","gists_url":"https://api.github.com/users/paysan58/gists{/gist_id}","starred_url":"https://api.github.com/users/paysan58/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paysan58/subscriptions","organizations_url":"https://api.github.com/users/paysan58/orgs","repos_url":"https://api.github.com/users/paysan58/repos","events_url":"https://api.github.com/users/paysan58/events{/privacy}","received_events_url":"https://api.github.com/users/paysan58/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-02T15:19:57Z","updated_at":"2016-02-02T15:19:57Z","closed_at":null,"body":"Please, could you change initializeBuchetteArea(element) as below\r\n(last line : element.trigger(\"change\");)\r\n\r\n    function initializeBuchetteArea(element) {\r\n        element.addClass(\"buchette-area\");\r\n        \r\n        element.data().addBuchette = function (items) {\r\n            $.each(items, function (i, item) {\r\n                var buchette = $(\"<li>\" + item.label + \"<a href=\\\"#\\\"><i class=\\\"fa fa-remove\\\"></i></a></li>\")\r\n                    .on(\"click\", \"a\", function () {\r\n                        item.callback(item.ref);\r\n                        $(this).parent().remove();\r\n                        element.trigger(\"change\");\r\n                    });\r\n\r\n                buchette.remove = function () {\r\n                    $.fn.remove.apply(this, arguments);\r\n                    element.trigger(\"change\");\r\n                };\r\n\r\n                buchette.data().filter = item.filter;\r\n                buchette.data().data = item.ref.data;\r\n\r\n                element.append(buchette);\r\n                item.ref.buchette = buchette;\r\n            });\r\n            element.trigger(\"change\");\r\n        };\r\n    };"}}