• harish reddy 37
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies
I'm seeking more info on lightning:input for use in a Lightning Component.

What I want to do is have the input text field submit when the user presses the Enter key. However, the Enter key seems to be ignored by lightning:input. Also, I can't even retrieve the keycode with my handler.

component markup:
                  <lightning:input aura:id="body"
                                         label=""
                                         name="Body"
                                         placeholder="Enter message..."
                                         value="{!v.Message.Body__c}"
                                         onchange="{!c.keyCheck}"/>

                    </lightning:layoutItem>
And my keyCheck handler:
keyCheck: function(component, event, helper){
        console.log(event.getParams('keyCode')); 
        }
The handler is getting called, but the value is undefined. I think it's undefined because the event that is happening is NOT the keypress/keyDown/keyUp, but rather the input field is changing. But lightning:input chokes (won't compile) if I try to add a keyDown event in its parameters in the markup.

BTW, I've tried doing this with ui:inputText as well, and that doesn't work either.

Help please?

 
Hi Folks,

I am having an apex class which is having AuraEnabled method which returns list of accounts to <aura:iteration >. I am not able to display the list in component.Code is very simple nothing complicated.
  
Need help ASAP.


<aura:component controller="Accounts">
    <aura:attribute name="Acc" type="Account[]" default="{'sObjectType':'Account',
                                                                         'Name':'',
                                                         'Id':''}"/>
    <aura:iteration items="{!v.Acc}" var="acc">
    <p>{!acc.Name}</p>
    </aura:iteration>
</aura:component>

//Server side controller
public with sharing class Accounts {
    @AuraEnabled
    Public Static List<Account> getAccount(){
  return  [Select Name,id from Account LIMIT 2];
      
    
}
}