Bug: Smart Select and Fill form Data

Good day

There seems to be a bug for this combination

after fetching data from database

here is the template

<a class="item-link smart-select smart-select-init data-back-on-select">
                      <select name="geventtype" id="geventtype">
                        {{#each sportlist}}
                        
                        <option value="{{gtypeid}}">{{gtypename}}</option>
                        
                        {{/each}}
                      </select>
                      <div class="item-content">
                        <div class="item-inner">
                          <div class="item-title">Sport Type</div>
                        </div>
                      </div>
                    </a>

here is the code

//populate smart select data 

var self = this;
            var app = self.$app;
            app.request.post($base_url+'gameeventstype/read_paging.php'+$base_param , JSON.stringify(udata), (rdata) => {
              rdata=JSON.parse(rdata);
              var items = rdata.records;
              self.$setState({
                  sportlist: items   
                })
            });

//Fill form data 
 app.request.post($base_url+'gameevents/read_one.php'+$base_param, JSON.stringify(udata) ,(data)=> {
                //create datepickers
                
                data=JSON.parse(data)
                self.$setState({
                  game: data   
                })
                game=data

                //preload form
                console.log(game);
                console.log(game.geventtype);
                app.form.fillFromData('#my-gameform', game);
                
                
                app.preloader.hide();

output is sometimes the selected item is showing and sometimes not showing

i need a consistent behavior

thanks

Найдите конкретное место в коде, которое работает не так, как ожидается.

I would better wrap smart select item with the if statement to show and init it when data has loaded:

{{#if sportlist.length}}
<li>
  <a class="item-link smart-select smart-select-init data-back-on-select">
   ...
  </a>
</li>
{{/if}}

i forgot to mention that sportslist and fill form data happens on page initialization

i would assume all data is present prior to page rendering

hope this helps