Semantic-ui: Reset Dropdown to Initial State

Created on 30 Dec 2013  路  8Comments  路  Source: Semantic-Org/Semantic-UI

I'm using dropdown as per the spec. I need to reset my dropdown to its initial state.. 'Select Age' at some point, after the user has changed its value by selecting the items in the dropdown.

For, If the user has selected first option '20-30' and then after form submit How could I reset the dropdown to its initial value of 'Select Age'

<div class="ui dropdown">
  <div class="text">Select Age</div>
  <i class="dropdown icon"></i>
  <div class="menu">
    <div class="item" data-value="20-30">20-30</div>
    <div class="item" data-value="30-50">30-50</div>
  </div>
Enhancement

Most helpful comment

@ctilley83 thinking the same. When you got the "response" from a confirm dialog, the 'restore defaults' dosen't work pretty well.

All 8 comments

This feature is not yet available, but needs to be. Adding as enhancement

Added in 0.12.0

Minor styling problem with current reset dropdown box code:

E.g.

$('.ui.form .ui.dropdown').dropdown('restore defaults');

It sets the original displayed markup

<div class="default text">Gender</div>

To

<div class="text">Gender</div>

Which results in losing its grey color as a placeholder.

@oniisaki I honest to god don't think they've fixed this yet

@ctilley83 thinking the same. When you got the "response" from a confirm dialog, the 'restore defaults' dosen't work pretty well.

Tested on 2.2.2, it keeps the class on the but it removes any icon you put inside:

<span class="default text">
    <i class="users icon"></i>
    Clients
</span>

to

<span class="default text">
    Clients
</span>

yeah, I need to clear all the options and use apiSetting again to get new options

@ShukriChiu Have you found a solution to this yet?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kntmrkm picture kntmrkm  路  3Comments

arj-196 picture arj-196  路  3Comments

Morrolan picture Morrolan  路  3Comments

batata004 picture batata004  路  3Comments

playgithub picture playgithub  路  3Comments