1

How can I create an autocomplete input text in lightning component Please help either by suggest library or create one from scratch

I tried this: https://gist.github.com/peterknolle/ef17727d994332a8ef6b#file-autccomplete-cmp

but it said that ' $j is not defined'

and also tried the one in lightning design system but it does not work and even its style is bad ( see image): https://www.lightningdesignsystem.com/components/lookups/

enter image description here

  • In the first look you provided, it requires to add JQuery as a static resource. Did you add it? – Martin Lezer Jul 31 '17 at 8:56
  • yes I added jquery, but not same, I added jquery 2.2.4 because it is the one that compatible with locker service – sundus Jul 31 '17 at 9:22
  • Are you sure you imported well here? <aura:requires baseUrl="/resource/" scripts="{jquery:'jquery/jquery.js',jqueryui:'jqueryui/jquery-ui.js'}" deps="{jqueryui:['jquery']}" styles="{jqueryui:'jqueryui/jquery-ui.css'}" requiresReady="c.init" /> – Martin Lezer Jul 31 '17 at 9:26
  • Here is a great component from Philippe Ozil: github.com/pozil/sfdc-ui-lookup-lwc. Sharing the link as it might help someone. – SFDC Dev 27 Jul 24 at 21:17
1

Find Below link , Its small demo on auto complete on account lookup using lightning. Full source present in git hub, with guidance. This will help you.

Reference Lookup auto complete

  • thanks, I will try .. but can I import it as unmanaged package? – sundus Jul 31 '17 at 9:57
  • Sorry i am not did Unmanaged Package for now. – NITHESH K Jul 31 '17 at 10:59
  • when I write letter it display error : Error in $A.getCallback() [Cannot read property 'label' of null] Failing descriptor: {markup://ui:input} – sundus Jul 31 '17 at 11:24
  • sfdcmonkey.com/2017/01/07/custom-lookup-lightning-component as reference for further . – NITHESH K Aug 1 '17 at 7:21
  • Your welcome .. – NITHESH K Aug 2 '17 at 4:19
0

Another fantastic option is Philippe Ozil's lookup component. You can also leverage lightning:inputField or lightning:recordForm to do a lookup for you as well, and then catch the value and process it on your own.

These options are laid out in this post

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.