Select2 and Ember.js - unable to set initial value

Today I spent many hours trying to figure out what happened. I am trying to set the initial value as soon as some data is loaded via content.isLoaded . This is done after the contents of CreditCards and CardProviders uploaded, as you can see in the attached photo: attached photo . But somehow he cannot set this value:

 selectDefaultValue: (-> if !@get 'multiple' console.log 'content loaded' window.$select = @$('.filter-select').first() # get provider id id = $('#ember-container').attr('data-providerId') console.log 'id: ', id $select.select2 'val', id ).observes('controller.controllers.application.canSetDefaultProvider') 

But when I try window.$select from the console, it works!

canSetDefaultProvider set to true when loading the contents of CreditCards and CardProviders .

+4
source share

Source: https://habr.com/ru/post/1493813/


All Articles