Semantic-Org/UI-Dropdown

Default values not working with data providen by API

nmrgt opened this issue · 1 comments

nmrgt commented

HTML Code

 <div class="ui multiple selection search dropdown"  multiple="" id='tagUdxxQ9S23F'>
  <input name='tag' type="hidden" value='20,23,19'>
  <div class="default text">A placeholder</div>
      <div class="menu">
          <div class="item" data-value="20">Hello</div>
          <div class="item" data-value="23">world</div>
          <div class="item" data-value="19">!!!</div>
        </div>
  </div>

JS Code

$('#tagUdxxQ9S23F')
  .dropdown({
    allowAdditions: true,
    apiSettings: {
      url: 'http://mydomain/tag/{query}',
    }
});

Use example : modify tag for a simple article. The tags available are retrieved from API but the already used tag are set directly in HTML as default value. With these settings, only the first tag value is replaced by the variable text, so the visual result is:
[Hello | 23 | 19]
If I disable apiSettings, everything works fine but I can't retrieve new tag from API to add some.

Thanks for the module !

Please contribute to main repo. Also see note on usage questions.