Newer Version Available
aura:doneRendering
Indicates that the initial rendering of the root
application has completed.
This event is automatically fired if no more components need to be rendered
or rerendered due to any attribute value changes. The aura:doneRendering event is handled by a client-side controller. A
component can have only one <aura:handler> tag
to handle this event.
The aura:doneRendering handler contains these
required attributes.
1<aura:handler event="aura:doneRendering" action="{!c.doneRendering}"/>
For example, you want to customize the behavior of your
app after it’s finished rendering the first time but not after subsequent
rerenderings. Create an attribute to determine if it’s the first
rendering.
1<aura:component>
2 <aura:handler event="aura:doneRendering" action="{!c.doneRendering}"/>
3 <aura:attribute name="isDoneRendering" type="Boolean" default="false"/>
4 <!-- Other component markup here -->
5 <p>My component</p>
6</aura:component>
This client-side controller checks that the aura:doneRendering event has been fired only
once.
1({
2 doneRendering: function(cmp, event, helper) {
3 if(!cmp.get("v.isDoneRendering")){
4 cmp.set("v.isDoneRendering", true);
5 //do something after component is first rendered
6 }
7 }
8})| Attribute Name | Type | Description |
|---|---|---|
| event | String | The name of the event, which must be set to aura:doneRendering. |
| action | Object | The client-side controller action that handles the event. |