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

controlled <Select showSearch /> #13551

Closed
1 task done
dancerphil opened this issue Dec 10, 2018 · 5 comments
Closed
1 task done

controlled <Select showSearch /> #13551

dancerphil opened this issue Dec 10, 2018 · 5 comments

Comments

@dancerphil
Copy link
Contributor

dancerphil commented Dec 10, 2018

Issuehunt badges

  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

需求:期望在 Select 处于 input 状态时,显示的 placeholder 与 placeholder 字段相同。

在 Select 的远古时期,可能是由于 showSearch 会使得 placeholder 为空,于是前人用 .ant-select-selection-selected-value::before { content: 'placeholder' } hack 了这个问题。

然而,当 showSearch 默认的 placeholder 为 value 时,这个 hack 就失败了,会显示 hackText + value,同时,我们没有办法定义 searchPlaceholder

有一个相似的 issue

另外,searchValue 是不受控的,需求:当 search 时,先默认当前 value,这个需求也是做不了的(虽说没遇到这个需求,但这个需求显得常见)

如果接口没有问题,我可以 pr。

What does the proposed API look like?

<Select
  showSearch
  value="value"
  placeholder="placeholder"
  searchValue="searchValue" // 有此字段则完全受控
  searchPlaceholder="searchPlaceholder" // 有此字段则覆盖默认
>
  <Option ... />
</Select>

IssueHunt Summary

zombiej zombiej has been rewarded.

Backers (Total: $20.00)

Submitted pull Requests


Tips

@IssueHuntBot
Copy link

@issuehuntfest has funded $20.00 to this issue. See it on IssueHunt

@afc163
Copy link
Member

afc163 commented Mar 16, 2020

https://codesandbox.io/s/dreamy-butterfly-vdrne

searchValue of antd v4 Select is controlled prop now.

@afc163 afc163 closed this as completed Mar 16, 2020
@johnzhu12
Copy link

v4.0.0 still not working and this class ant-select-selection-selected-value also missing

@yoyo837
Copy link
Contributor

yoyo837 commented Jan 13, 2021

Feel free to open a new issue please.

Copy link

issuehunt-oss bot commented Aug 31, 2024

@afc163 has rewarded $14.00 to @zombiej. See it on IssueHunt

  • 💰 Total deposit: $20.00
  • 🎉 Repository reward(20%): $4.00
  • 🔧 Service fee(10%): $2.00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants