You need to sign in to do that
Don't have an account?
Bryant Daniels 46
Lightning Input Type Search
Hello I am using the Search input from the lightning input components.
<div onkeyup="{! c.handleKeyUp }"> <lightning:input aura:id="enter-search" name="enter-search" label="Search when user hits the 'enter' key" type="search" />
When I am implementing it this is fine, the problem i am having is how would i clear the contents or have a event fire when you click the "Clear Icon" that is built in the component.
<div onkeyup="{! c.handleKeyUp }"> <lightning:input aura:id="enter-search" name="enter-search" label="Search when user hits the 'enter' key" type="search" />
When I am implementing it this is fine, the problem i am having is how would i clear the contents or have a event fire when you click the "Clear Icon" that is built in the component.
Use oninput moreover.
The clear button (cross) should be at the end of line automatically.
Thank for that, this solution wouldn't work for me as I am using this search as a TypeAhead, so i need to call that function on every keyup input, as the oniput seems to do the same, it would be nice if i could just isolate the icon, but I'm not sure that I can get to it. I will more than likely just use a lightning: input of type text and add the lightning:icon with it along with some CSS.
This solution works fine for me and it is standard.
If you don't provide your code or context, very few people will help you now on this forum (old question of May 1).
You can try this forum https://salesforce.stackexchange.com/ more successfully.
I don't know what is a "search as a TypeAhead" (?) for example.
Thanks for the link and I will def check out that link but what I am saying is that I am using the Lightning: input of type search as a typeahead or some people call it lookup, so for example if I type in the search input field "Gra" it will produce all records that are like "Gra" of a particular record. This works just fine for me except that if I want to use that clear button icon that comes with the component I have no way of just clicking that.
You can write code like this
<lightning:input label="Search for offer" type="search" variant="label-hidden" placeholder="Search for offer.." onchange="{! c.handleSearchOffer }" />
Please wrtie code for onchange in controller