Newer Version Available
aura:doneRendering
Indicates that the initial rendering of the root
application or root component 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
event="doneRendering"> tag to handle this event.
The aura:doneRendering handler contains these
required attributes.
1swfobject.registerObject("clippy.codeblock-0", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17<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.
1swfobject.registerObject("clippy.codeblock-1", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17<aura:component>
18 <aura:handler event="aura:doneRendering" action="{!c.doneRendering}"/>
19 <aura:attribute name="isDoneRendering" type="Boolean" default="false"/>
20 <!-- Other component markup here -->
21 <p>My component</p>
22</aura:component>
This client-side controller checks that the aura:doneRendering event has been fired only
once.
1swfobject.registerObject("clippy.codeblock-2", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17({
18 doneRendering: function(cmp, event, helper) {
19 if(!cmp.get("v.isDoneRendering")){
20 cmp.set("v.isDoneRendering", true);
21 //do something after component is first rendered
22 }
23 }
24})| 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. |