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.
<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.
<aura:component>
<aura:handler event="aura:doneRendering" action="{!c.doneRendering}"/>
<aura:attribute name="isDoneRendering" type="Boolean" default="false"/>
<!-- Other component markup here -->
<p>My component</p>
</aura:component>
This client-side controller checks that the
aura:doneRendering event has been fired only
once.
({
doneRendering: function(cmp, event, helper) {
if(!cmp.get("v.isDoneRendering")){
cmp.set("v.isDoneRendering", true);
}
}
})
The
aura:doneRendering handler contains these
required attributes.
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. |