admin管理员组

文章数量:1193168

What is the difference between events like afterLayout and layout, afterRender and render? I understand the difference between beforeLayout and afterLayout -- but how does layout event differ?

What is the difference between events like afterLayout and layout, afterRender and render? I understand the difference between beforeLayout and afterLayout -- but how does layout event differ?

Share Improve this question asked Aug 7, 2010 at 10:27 TowerTower 103k131 gold badges364 silver badges518 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 26

Note: Applies to Ext 3.x only. This was answered in 2010.

There is no 'layout' event, only afterLayout. From the docs, afterLayout "Fires when the components in this container are arranged by the associated layout manager" which is pretty self-explanatory. afterLayout is only fired by Container subclasses that are responsible for laying out child components.

One the other hand, all Component subclasses (including Containers) fire the render and afterRender events. The basic difference is simply that afterRender fires later. render fires after the DOM markup is finished rendering, but before other things that might happen (like hiding, disabling, state-restoration, etc.) during the rendering process. afterRender fires as the very last event after all of that is complete. To fully understand this you should look at the source for the Ext.Component.render() method, which shows step-by-step how the rendering process works and when these events are fired.

本文标签: javascriptafterLayout vs layoutafterRender vs renderetc in ExtJSStack Overflow