function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Vardan Minasyan 9Vardan Minasyan 9 

Creating autocomplete textbox in Lighting Web Components

Hi! 
I want to use/create an autocomplete textbox using Lightning Web Components. Particularly, I want an autocomplete textbox for looking up a PriceBookEntry2 so that I can add a product to an opportunity, on the same page as Opportunity. 
I see options for autocomplete textbox for Visual Force, for Aura Lightning. However, I can't find anything for Lightning Web Components. 

I do see Lightning-Input (https://developer.salesforce.com/docs/component-library/bundle/lightning-input/example), but I don't know how to make it an autocomplete type.

What's the best way to go about it?

The final result needs to be an opportunity form, where a person can add/edit/delete products on the same page. 
Best Answer chosen by Vardan Minasyan 9
Nayana KNayana K
https://newstechnologystuff.com/2019/05/01/custom-lookup-in-lightning-web-components/

You can try implementing this lookup comp

All Answers

Nayana KNayana K
https://newstechnologystuff.com/2019/05/01/custom-lookup-in-lightning-web-components/

You can try implementing this lookup comp
This was selected as the best answer
Vardan Minasyan 9Vardan Minasyan 9
Hi Nayana, 
Thanks for the link - that's what I was looking for!
Nayana KNayana K
Please mark this post as solved if it helped you
Soudamini GombiSoudamini Gombi
Hi Nayana,
Can we use the same iwth the Custom Setting ? 
Instead of @api objectName = 'Account'; @api fieldName = 'Name'; ? 
Soudamini GombiSoudamini Gombi
Also , this is in AURA , anything for Lightning  ?
Ishav SinghIshav Singh
Almost similar to the initial question posted here. However, I have a JSON and need to search that based on the user Input.
How to search JSON as per the input passed by user in LWC
I have a JSON and I need to search the JSON based on the input entered by the user. E.g if User has passed 12, so all the codes matching the 12 in the JSON should be displayed. Can anyone let me know:
{
"test': {
"Code" : [
{
"Name" : "test 1",
"Location" : "India",
"Code" : "1211"
},
{
"Name" : "test 2",
"Location" : "U.K",
"Code" : "1233",
{
"Name" : "test 3",
"Location" : "U.S.A",
"Code" : "1239"


JS:
I have parsed the JSON and stored it in the variable : areacodeDetails
var currentText = event.target.value;
this.areacodeDetails.forEach(area => {
if(currentText.length > 0){
// Need to know how to filter in that JSON
Coding SalesforceCoding Salesforce
Hey guys, here is a free Autocomplete component that you could use on your LWC: Autocomplete (https://codingsalesforce.com/components/autocomplete/). There are a few designs, so you can select the one that more adapts to your business logic.