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
AutoComplete Show Dropdown When Clicked #2445
Comments
@melloware have you ever face with that problem before? |
Let me investigate. It might be possible now or it might have to be a new property. |
@EmirBoyaci yep here you go with working example... Sorry I messed up my CodeSandbox. But here is its... const ref = useRef(null);
<AutoComplete ref={ref} onClick={(e) => ref.current.search(e, "", "dropdown")} /> |
@EmirBoyaci if after testing you find it meets your needs please close the ticket. |
Thanks for your quick reply! That's what I need but just one more question. I didn't used refs with TypeScript before so I couldn't find the correct type for that: const ref = useRef(null); The first error that I got is: If I use non-null assertion operator I've got 2nd error which is: The solution that you provide is works below but I wanna use correct type for useRef. Do you know the correct type for the useRef? const ref = useRef<any>(null); |
Here is a working example: https://codesandbox.io/s/primereact-test-forked-5jgb7?file=/src/index.tsx A for the Search error its only because the search method is not listed in the TypeScript file but it is definitely on the component. I used |
Please close this ticket once you have verified my code above. Thanks! |
I just thought maybe we have a solution different than |
@EmirBoyaci you can re-open this I added the search method to the TS doc in the PR. |
I’ve reopened
|
Normally, when AutoComplete clicked we want to see the selectable items however current AutoComplete components doesn't have this feature. It only shows selectable items when dropdown prop is true and dropdown icon is clicked but, we want when user clicks inside AutoComplete it will show dropdown and selectable items. How can we add that feature to AutoComplete component? Is it possible to do on our own or need PR?
Browser: all
Language: TypeScript 4.4.4
The text was updated successfully, but these errors were encountered: