Questions tagged [lightning-events]

Lightning Events are a way for markup component to communicate its changing state

18
votes
4answers
4k views

Lightning Components: how to use events to detect record updates?

I have a custom Lightning Component sitting on a Flexipage for e.g. Account. Now I want to register an handler, which will be invoked each time, the record is updated. Updates might happen via ...
17
votes
4answers
583 views

Why EXACTLY not calling Aura.Action attribute from Lightning Controller using $A.enqueueAction()?

Since the event registration/subscription feels like a long roundtrip for simple things, I found a "hack" for implementing a simple onchange handler in my own Lightning Components in form of an Aura....
13
votes
2answers
2k views

Lightning Events: why force:refreshView is fired 4 times when a record is updated via standard Record Detail on Flexipage?

I need to detect record-updates by different sources as stated here: Lightning Components: how to use events to detect record updates? For this example, I'm using the standard Record Detail compo on ...
11
votes
3answers
1k views

How to link Lightning Components using events inside a Lightning App Builder page?

I have a set of Lightning Components that I want to allow customers to assemble in different layouts and combinations inside the Lightning App Builder. These components interact: when a user clicks on ...
10
votes
2answers
3k views

Reliable way to clear a setInterval used by a Lightning Component?

I'm using JavaScript's setInterval to run some client code every few seconds in a Lightning Component and also have clearInterval logic working to remove that timer within the component. But if user ...
10
votes
1answer
9k views

lightning:spinner solution that finally works (using custom events, not aura:waiting)

Lightning components without a working loading indicator are just not professional. Too bad that there is not code example out there that seems to work under real-world circumstances.Every blog out ...
9
votes
1answer
604 views

Send Lightning events only to nested components

I have a nested component structure <c:parent> <c:child /> <c:child /> </c:parent> and I want c:parent to send a COMPONENT event which is received by the c:child ...
8
votes
0answers
260 views

Make custom, in-memory “Lightning Data Service” work

Lightning Data Service is great. Multiple components are magically linked to database records. When records change in the db component show that change. Imagine this to work without saving change to ...
7
votes
2answers
3k views

$A.util.removeClass happens seconds after execution

I'm changing data in a component and show a spinner as soon as changes happen. The handler executes all the lines, but $A.util.removeClass(cmp.find("loading"), 'slds-hide'); seems to be fired after ...
7
votes
3answers
11k views

Lightning RefreshView event not working on record detail page

I found that the RefreshView event doesn't always reload record data. I'm writing a Lightning Component that updates a record, then tries to reload the record details to show the changes, but ...
7
votes
1answer
820 views

Workaround for application event duplicates in cached lightning components (IN LOCKERSERVICE)?

This link should provide a lot of background information for my issue. Basically the problem is with Application Events, and cached lightning components. If your lightning component lives inside a ...
7
votes
1answer
122 views

Can we use the event's attribute “path” in Lightning?

I've been working on a pretty complicated component, and I've had all kinds of trouble simply trying to identify which element is currently being used. After all sorts of experiments, I found a really ...
7
votes
2answers
2k views

Reload after “e.force:editRecord”?

I have a Lightning Component that displays a lightning:dataTable of custom object records. Displayed fields include Name, Amount, and Date. I need the fields to be editable, but dataTable's inline ...
7
votes
1answer
849 views

Lightning Events: how to get the name of an Application event in the handler

I want to have one method for ALL events. In that method, I need to dispatch the event-name and whatever detail I can get about the event. The way I'm trying it, all seems to be empty (s. Result). Is ...
6
votes
1answer
5k views

Refresh parent page on close of lightning quick action modal

I have a custom lightning component which pops up when I click on a quick action in a record detail page. Once I click on a button in the popup, I want the popup to close and the parent detail page. ...
6
votes
1answer
1k views

Lightning:recordForm cancel button unresponsive

I'm building out some community features and one of them is like a related list with a new button. When the user presses the new button, I am launching a modal window with another custom component ...
6
votes
2answers
219 views

Distinguishing a change event when there are multiple instances of a child component

I'm building a form in Lightning where I want to use the Appiphony Strike lookup component to get input for lookup fields. I also have my own component that depends on the value selected for the ...
6
votes
1answer
641 views

Lightning Components: is the Standard Tab component firing app events when switching tabs?

I need to know when a tab is switched. Can I subscribe to an event and get notified? In my usecase I need to commit pending changes before user switches tabs or at least notify the user. Just need an ...
6
votes
1answer
547 views

How to run code when the browser window is resized in a Lightning Component?

I am running some code on the render event that decides whether or not some buttons related to scrolling are displayed depending on some element properties: <aura:handler name="render" value="{!...
5
votes
1answer
5k views

Lightning component event not fired or handled

To build a nested component structure as detailed here I have build the solution described in one of the answers which recommended to send an APPLICATION event... parentInitialized.evt <aura:...
5
votes
3answers
10k views

How do I get the Value of a ui:inputCheckBox Lightning Component?

I am currently stuck on an issue I am having getting the value of the ui:inputCheckbox Lightning component. In the Lightning Component Developer Guide, the following example is provided: COMPONENT ...
5
votes
1answer
189 views

Application Event fired by a child component doesn't flow down other child component

I have 1 main component (Parent.cmp) which includes 2 components (Brother1.cmp and Brother2.cmp). Brother1 fires an event which should cause an action in Brother2. Documentation says that we should ...
5
votes
1answer
3k views

How do I get the Lightning Component “destroy” system event to fire?

I have a fairly bog standard Lightning Component with markup like: <aura:component controller="MyController" implements="flexipage:availableForAllPageTypes,force:appHostable,force:hasRecordId,...
5
votes
3answers
493 views

cmp.set() is blocking the UI to re-render, but no event is triggered

I'm having a big table filled with custom cell components and after changing a cell, the table gets re-rendered. dataChanged: function(cmp, evt, helper) { var table = cmp.get("v.data"); ...
5
votes
3answers
867 views

Find changed variable/field name in aura:valueChange event

When using <aura:handler name="change" value="{!v.state}" action="{!c.changed}"/> I can see field go from old value to new one (event.getParam('oldValue')), but I cannot see which field it ...
5
votes
1answer
774 views

Is there an event to handle Successful creation of record when event force:createRecord is used

I am creating custom object records using standard salesforce record creation feature by firing the event force:createRecord from my custom component. After saving the record, Page navigates to ...
5
votes
1answer
332 views

Which force:* events must I declare as <aura:dependency>

I'm confused when to use <aura:dependency resource="force.."> and when not? If my component is using on of the following system events does it need to be explicitly declared as dependency? ...
5
votes
0answers
367 views

Lightning component error handleOnBlur event

I have an iteration on a component with an ui:inputNumber inside, which has an onchange event that calls a server side action. If after i change the value, i click on an input after the onchange is ...
5
votes
2answers
2k views

how to access the save button in a modal when implementing the force:lightningQuickAction

I am actually creating a component that will implement the force:lightningQuickAction so that my component open in a modal window from the action button.I would like to capture the event where the ...
4
votes
2answers
11k views

How to get parent lightning component's attribute in child component?

I have a parent component name "ParentComp" which has 3 attributes A,B and C of type String. I have a nested component "ChildComponent". I want to change the value of parent component's attribute B ...
4
votes
2answers
3k views

How do you stop an application event from propagating to another instance of the same component?

I'm currently building a native dynamic data table in lightning (not using any 3rd party libraries). For some features of the table to work, I had to use application events because component events ...
4
votes
1answer
713 views

Are lightning event synchronous or asynchronous?

Are lightning event synchronous or asynchronous? component1: <aura:component> <aura:handler name="event1" event="zced:TypeDoesNotMatter" action="{!c.event1Function}"/&...
4
votes
1answer
1k views

Event handler not invoked when event is fired

I am having trouble raising event from one component and capturing it in another component. Here is what i am trying to do. I have button on my home page. Clicking the button opens the first modal ...
4
votes
1answer
2k views

How to use event navigateToComponent

Can anyone help me? Trying to do very simple function to navigate from component to another. I copied the code from Developers guide, but for some reason it doesn't work for me. My function to ...
4
votes
2answers
785 views

force:recordData “recordUpdated”: Detect Trigger/Workflow Changes

I'm using Lightning Data Service in a component. It all works well. One item I've noted is that it does not seem to detect changes to fields which may have occurred via a trigger or workflow after a ...
4
votes
1answer
186 views

Async call from lighning component [onInit] to [afterRenderer]

is it possible to pass some arguments from the onInit method of a Lightning component to be performed when the renderer finishes? In my case I'm loading data in the onInit and want to modify some ...
4
votes
2answers
489 views

Dynamically Adding Event Handler within CreateComponents

UPDATE: Resolved by updating the Lightning Component Bundles being created to API version 43.0 ALSO: For future reference, the 8th line of the second code block (var el = els[i];) should instead be ...
4
votes
0answers
56 views

How can I manage lightning components' navigation-related caching

This is related to this question: Navigation in Desktop Lightning Experience not Destroying Components My components are listening to the force:refreshView event, but since the components are cached ...
3
votes
3answers
4k views

Callback event on $A.get('e.force:editRecord') in lightning

I'm using $A.get('e.force:editRecord') to display standard lightning edit modal window. I want to refresh my component after user saves the given record. However there are no callback events ...
3
votes
2answers
2k views

Lockerservice and event.getSource()

I have a few lightning components already written and those use <lightning:x /> markup. I am still not able to use event.getSource() instead of an aura:id in scenario where I do an aura:...
3
votes
2answers
2k views

Lightning openfiles error

I am using lightning:openFiles to popup the file in lightning but after doing research and searching similar post in Stack exchange i am still unable to find out the error. <aura:component ...
3
votes
1answer
446 views

Dynamic checkbox component in Lightning, unable to get event in controller

I am creating dynamic checkbox component in Lightning in helper class but I am not able to capture click event in controller class as value is undefined for event. Helper var checkBoxDef = []; var ...
3
votes
2answers
2k views

Communication between parent and child Lightning components during initialization

I'm building a component structure of the kind <c:parent> <c:child name="xyz" /> </c:parent> and I need the parent to know about its children. Why, because the parent is ...
3
votes
1answer
2k views

Firing Events from the Visualforce and Handling the Events in lightning components

If I have a visualforce page embedded in a lightning component. How can I fire a lightning event in the visualforce page and then handle it in the lightning component? In my Visualforce page i ...
3
votes
0answers
117 views

Is there any way to know when the standard cancel button is clicked in lightning after calling e.force:editRecord

I want to do some modification when standard cancel button is clicked in lightning..Is there any event or any other way to get that?
3
votes
0answers
399 views

Lightning “change” event doesn't fire in aura:Iteration

I am passing an Object to my component and iterate through it's child records. To handle changes I added the Lightning change handler. (I made data an array, so I can set a default for demo purposes, ...
3
votes
3answers
1k views

Can we reload screen after Save from force:editRecord event?

I've a Custom Lightning Component displaying a List custom object records. On each data row, I've custom button to Edit the record. On Edit click, I've fired following event: var editRecordEvent = $...
2
votes
2answers
5k views

How to call parent Lightning component's method in child component?

I want to create a Lightning component where i can define some custom actions which can be used by the component which is creating instance. It will be very similar to the onrowselection, onsort ...
2
votes
1answer
9k views

The campingList JavaScript controller isn't setting the 'item' as a parameter or saving the record correctly

I have been through several posts on workarounds to this issue where the code works, but the challenge is not passed, none of the proposed solutions seem to work for me: https://d2hwpln2xvs3s....
2
votes
2answers
216 views

Check events emited by lightning component from managed package

I have to cal some action in my lightning component when the child component finished rendering. Best practice AFAIK is to handle event thrown by child component, but the problem is that I dont have ...