jeudi 15 mars 2018

How to set semantic-ui-ember dropdown value?

I have a model, called assessmentTestModel, that is a list of assessmentTests. Each assessmentTest contains a unique identifier id, and form that is a reference to another object called form. Form also has a unique identifier, id.

For every assessmentTest in assessmentTestModel, I want to render a drop-down on the screen that's menu-items are all of the forms (I've already accomplished this). I also want them to have the selected default value of assessmentTest.form (This is the issue). Currently, when each drop-down is rendered, it displays the default text 'Select an Assessment Test'.

Here's an example of assessmentTestModel:

{ assessmentTestModel: [
      {
          id: '1029',
          form: '85'
      },
      {
          id: '1030',
          form: '87'
      },
      {
          id: '1031',
          form: '85'
      }
 ]
}

Here is my current .hbs file. I've tried setting the value attribute of the ui-dropdown to the id of the form, and the form object itself. Neither have worked.

<div class="field">
    <label>Assessment Tests</label>
    <ol>
        
            <li>
                
                    <div class="default text">Select an Assessment Test</div>
                    <i class="dropdown icon"></i>
                    <div class="menu">
                        <div data-value="" class="item">All Items</div>
                        
                            <div data-value="" class="item">
                                
                            </div>
                        
                    </div>
                
            </li>
        
    </ol>
</div>




Aucun commentaire:

Enregistrer un commentaire