title: dojo and dynamically added options to dijit.form.select
body: <p>I use dojo 1.8.2 and here is my problem (I have seen <a href="https://stackoverflow.com/questions/7869805/programmatically-set-the-selected-value-of-a-dijit-select-widget">this</a> and <a href="https://stackoverflow.com/questions/11159140/dijit-form-select-wont-set-value-programmatically">this</a> question, but they eren't helpful) :</p>
  
  <p>My <code>JS</code> code receives from server some data in <code>JSON</code> format. With that, I dynamically create some options for <code>dijit.form.select</code>:</p>
  
  <pre><code>var select = registry.byId('zgloszenieDoFirmyEdycja');
  for (var uzytkownik in dane.uzytkownicy){
      var idUzytkownika = dane.uzytkownicy[uzytkownik]['_id']['$oid'];
      var imie = dane.uzytkownicy[uzytkownik].imie;
      var nazwisko = dane.uzytkownicy[uzytkownik].nazwisko;
      var wybrany = (idUzytkownika == id);
      var opcja = {};
  
      opcja.label = imie + ' ' + nazwisko;
      opcja.value = idUzytkownika;
      opcja.selected = wybrany;
  
      console.log(wybrany);
      console.log(idUzytkownika + ' | ' + imie + ' ' + nazwisko);
      console.log(opcja);
  
      select.addOption(opcja);
      /*select.addOption({
          label: imie + ' ' + nazwisko,
          value: idUzytkownika,
          selected: wybrany
      });*/
  }
  </code></pre>
  
  <p>This is my console output:</p>
  
  <pre><code>false
  5077d2a1e4b0f5734a9850a1 | zero zero
  Object { label="zero zero", value="5077d2a1e4b0f5734a9850a1", selected=false}
  true
  50c0776f096aa0e726d221a3 | raz raz
  Object { label="raz raz", value="50c0776f096aa0e726d221a3", selected=true}
  false
  50d019c3096aa862c6898cdb | dwa dwa
  Object { label="dwa dwa", value="50d019c3096aa862c6898cdb", selected=false}
  </code></pre>
  
  <p>But after the <code>dijit.form.select</code> is updated, the <code>selected</code> parameter gets somehow mixed up and is set to true not for the option that I set it for, but for the first one:</p>
  
  <pre><code>console.log(select);
  ...
  Object[Object { label="zero zero", value="5077d2a1e4b0f5734a9850a1", selected=true},      
         Object { label="raz raz", value="50c0776f096aa0e726d221a3", selected=false}, 
         Object { label="dwa dwa", value="50d019c3096aa862c6898cdb", selected=false}
  ]
  ...
  </code></pre>
  
  <p>I don't understand why it happens, any clues?</p>