select2 loses its formatting when you select multiple elements then delete one/some of then

select2 loses its formatting when you select multiple elements then delete one/some of then

Hi

My select2 box allows you to select multiple options and then delete them if you change your mind. However it loses its formatting when you delete something. Mine is populated by ajax/php but here is one populated by json with the same problems

  1. <!DOCTYPE html>
  2. <html>
  3.     <head>
  4.         <link href="js/select2.css" rel="stylesheet"/>
  5.         <meta charset="UTF-8">
  6.         <title>Select2 tests</title>
  7.     </head>
  8.     <body>
  9.         <script src="js/jquery-1.11.1.min.js"></script>
  10.         <script src="js/select2.js"></script>
  11.         <label>Select2 with Ajax data  (e4)   </label>  
  12.         <input type="hidden" name="optionvalue" id="e4" class="input-xlarge" data-placeholder="Choose An Option.." />  
  13.         <br/>
  14.         
  15.         <script>
  16.             var a = [{"id":"1","text":"A+"},{"id":"2","text":"A-"},{"id":"3","text":"B+"},{"id":"4","text":"B-"},{"id":"5","text":"O+"},{"id":"6","text":"O-"},{"id":"7","text":"AB+"},{"id":"8","text":"AB-"},{"id":"9","text":"UNK"}];
  17.             $('#e4').select2({
  18.                 // minimumInputLength: 2,
  19.                 multiple: true,
  20.                 datatype: 'json',
  21.                 data: a,            
  22.             });
  23.         </script>
  24.     </body>
  25. </html>
Many thanks for your help