{"action":"created","issue":{"url":"https://api.github.com/repos/davidstutz/bootstrap-multiselect/issues/545","labels_url":"https://api.github.com/repos/davidstutz/bootstrap-multiselect/issues/545/labels{/name}","comments_url":"https://api.github.com/repos/davidstutz/bootstrap-multiselect/issues/545/comments","events_url":"https://api.github.com/repos/davidstutz/bootstrap-multiselect/issues/545/events","html_url":"https://github.com/davidstutz/bootstrap-multiselect/issues/545","id":78831472,"number":545,"title":"Report an issue: incorrect selected item number ","user":{"login":"soyosolution","id":5309660,"avatar_url":"https://avatars.githubusercontent.com/u/5309660?v=3","gravatar_id":"","url":"https://api.github.com/users/soyosolution","html_url":"https://github.com/soyosolution","followers_url":"https://api.github.com/users/soyosolution/followers","following_url":"https://api.github.com/users/soyosolution/following{/other_user}","gists_url":"https://api.github.com/users/soyosolution/gists{/gist_id}","starred_url":"https://api.github.com/users/soyosolution/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soyosolution/subscriptions","organizations_url":"https://api.github.com/users/soyosolution/orgs","repos_url":"https://api.github.com/users/soyosolution/repos","events_url":"https://api.github.com/users/soyosolution/events{/privacy}","received_events_url":"https://api.github.com/users/soyosolution/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/davidstutz/bootstrap-multiselect/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-05-21T04:58:24Z","updated_at":"2015-09-09T00:11:09Z","closed_at":null,"body":"The issue was found  with `Bootstrap 3` & `jquery 1.11.2`\r\nWhen clicking \"select all\" and then un-select a few items, it would keep showing 5 selected (the right total selected items number is 3)\r\n\r\n![problem00](https://cloud.githubusercontent.com/assets/5309660/7741651/79dcc06c-ffb4-11e4-993a-e6b2e7fa777d.PNG)\r\n\r\nContinue with this case, if I re-select some of the items again (but not all items), The text would show \"All selected (6)\"\r\n![problem01](https://cloud.githubusercontent.com/assets/5309660/7741652/7ddf77ae-ffb4-11e4-9ea4-ed9ef477484b.PNG)\r\n\r\nHere is my code for the case:\r\n\r\nJavaScript\r\n-----------\r\n```\r\n<script type=\"text/javascript\">\r\n    $(function () {\r\n        $('#skill-filter').multiselect({ includeSelectAllOption: true });\r\n    });\r\n</script>\r\n```\r\n\r\nHTML\r\n-----------\r\n```\r\n<select id=\"skill-filter\" title=\"Skill\" name=\"skill\" class=\"form-control\" multiple=\"multiple\">\r\n    <option value=\"indo\">Skill 1</option>\r\n    <option value=\"fili\">Skill 2</option>\r\n    <option value=\"fili\">Skill 3</option>\r\n    <option value=\"fili\">Skill 4</option>\r\n    <option value=\"fili\">Skill 5</option>    \r\n    <option value=\"fili\">Skill 6</option>        \r\n</select>\r\n```\r\n\r\nUpdate at 15:08pm 21st May,2015 for adding an existing live example on internet: \r\nhttp://jsfiddle.net/StephenEdmondson/TR49m/4/\r\n\r\n![problem02](https://cloud.githubusercontent.com/assets/5309660/7743244/7f00105a-ffcb-11e4-946b-519aad255daa.PNG)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/davidstutz/bootstrap-multiselect/issues/comments/138736263","html_url":"https://github.com/davidstutz/bootstrap-multiselect/issues/545#issuecomment-138736263","issue_url":"https://api.github.com/repos/davidstutz/bootstrap-multiselect/issues/545","id":138736263,"user":{"login":"ekinhbayar","id":6135846,"avatar_url":"https://avatars.githubusercontent.com/u/6135846?v=3","gravatar_id":"","url":"https://api.github.com/users/ekinhbayar","html_url":"https://github.com/ekinhbayar","followers_url":"https://api.github.com/users/ekinhbayar/followers","following_url":"https://api.github.com/users/ekinhbayar/following{/other_user}","gists_url":"https://api.github.com/users/ekinhbayar/gists{/gist_id}","starred_url":"https://api.github.com/users/ekinhbayar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ekinhbayar/subscriptions","organizations_url":"https://api.github.com/users/ekinhbayar/orgs","repos_url":"https://api.github.com/users/ekinhbayar/repos","events_url":"https://api.github.com/users/ekinhbayar/events{/privacy}","received_events_url":"https://api.github.com/users/ekinhbayar/received_events","type":"User","site_admin":false},"created_at":"2015-09-09T00:11:09Z","updated_at":"2015-09-09T00:11:09Z","body":"I had the same issue when using 6 different selects on a page, was able to fix this by using the 'rebuild' method as below:\r\n\r\n    $(document).ready(function() {\r\n           $('#sample').multiselect();\r\n           $('#sample').change(function(){\r\n                if($(this).val() !== '') {\r\n                    $('#sample').multiselect('rebuild');\r\n                }\r\n            });\r\n     });"}}