Tuesday, December 19, 2017

Shortcut key for Lightning Component Button.

Scenario: Use the previously posted lightning component (UpdateStudent) [Post Subject : Crate a lightning component to update record.].
Now suppose we want to create/develop shortcut keys for "Save" [Alt + s] and "Cancel" [Alt + c] button for out component.


Solution: To develop the shortcut key in lightning component use "accesskey" key-word under your "lightning:button" component. So, for the above scenario use the below syntax under your "lightning:button" component,

  • For Save : accesskey="s"
  • For Cancel : accesskey="c"
And the button code base is look like this for our UpdateStudent component,

                <lightning:button aura:id="cancelId"
                                  label="Cancel"
                                  variant="brand"
                                  onclick="{!c.doCancel}"
                                  accesskey="c"/>
               
                <lightning:button aura:id="saveId"
                                  label="Save"
                                  variant="neutral"
                                  onclick="{!c.doSave}"
                                  accesskey="s"/>

So, update the component's buttons part with above code base and use "Alt + s" and "Alt + c" for save and cancel operation respectively.

Data Cloud Part 6: Practical (Ingest Physical Store's Customer details and Sales details)

Hope you have already created your Data Cloud Org and also downloaded the Customer's details and Sales details from previous posts.  Now...