Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request][Dropdown] Clean Selection ... #992

Closed
ziaratban opened this issue Sep 3, 2019 · 6 comments
Closed

[Feature Request][Dropdown] Clean Selection ... #992

ziaratban opened this issue Sep 3, 2019 · 6 comments
Labels
type/feat Any feature requests or improvements type/usage Any support issues asking for help
Milestone

Comments

@ziaratban
Copy link

ziaratban commented Sep 3, 2019

Feature Request

Description

how i can implements this feature by set a setting ?

Example

<div class="ui search selection dropdown">
  <i class="dropdown icon"></i>
  <input name="language" type="hidden" class="" value="fa_IR">
  <input class="search" autocomplete="off" tabindex="0">
  <div class="default text"></div>
  <div class="menu " tabindex="-1">
    <div class="item" data-value="fa_IR">فارسی (ایران)</div>
  </div>
</div>
$('.ui.dropdown').dropdown({
  forceSelection : false,
  fullTextSearch : true,
  onHide : function(){ //feature is here
    $(this).dropdown('set selected',$(this).dropdown('get value')).find('>input.search').val('');
  },
});

Testcase

http://jsfiddle.net/jr6tnge1/

@lubber-de
Copy link
Member

There is no setting, but an existing behavior to shorten your code:

$(this).dropdown('remove searchTerm');

See http://jsfiddle.net/c4pyLvus/

@lubber-de lubber-de added the type/usage Any support issues asking for help label Sep 3, 2019
@ziaratban
Copy link
Author

yes. but i think this feature must be added to setting for prevent complexity.

@lubber-de
Copy link
Member

lubber-de commented Sep 3, 2019

What is your use case so forceSelection:true does not work for you? It will remove the searchTerm when it does not match any dropdown entry as expected
See http://jsfiddle.net/5uckpnga/

The intention of forceSelection:false basically is to not remove the searchterm but let the user select something which is not in the list

@ziaratban
Copy link
Author

ziaratban commented Sep 4, 2019

because when i set forceSelection to true and be typed part of text and focus out of input , one of item in list , selected!
is not good.

@lubber-de
Copy link
Member

I am still not understanding your use case.'forceSelection:true of course selects anything matching while typing, that's the intention of it.
The code you are providing always removes the search term when hiding the menu. That is not the intention of forceSelection:false . It's meant to be able to select something which is not in the list.
I am not sure if we really should add an option to always remove the searchterm on hide if nothing is found... Let's see what others say

@lubber-de
Copy link
Member

@ziaratban After thinking about it for a while now, i think we can make use of the already existing allowAdditions setting. This is false by default and should remove the searchterm when it does not match anything.
I prepared a PR to support that here #1002

@lubber-de lubber-de added the type/feat Any feature requests or improvements label Sep 5, 2019
@lubber-de lubber-de added the tag/next-release/nightly Any issue which has a corresponding PR which has been merged and is available in the nightly build label Sep 13, 2019
@lubber-de lubber-de added this to the 2.8.0 milestone Sep 24, 2019
@lubber-de lubber-de added state/has-pr An issue which has a related PR open and removed tag/next-release/nightly Any issue which has a corresponding PR which has been merged and is available in the nightly build labels Sep 30, 2019
@lubber-de lubber-de added tag/next-release/nightly Any issue which has a corresponding PR which has been merged and is available in the nightly build and removed state/has-pr An issue which has a related PR open labels Nov 12, 2019
@y0hami y0hami closed this as completed in ce29d09 Nov 14, 2019
@y0hami y0hami removed the tag/next-release/nightly Any issue which has a corresponding PR which has been merged and is available in the nightly build label Nov 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feat Any feature requests or improvements type/usage Any support issues asking for help
Projects
None yet
Development

No branches or pull requests

3 participants