javascriptdojodijit.formdojox.charting

startup and postCreate function in Dojo


I am new to Dojo library, I come across postCreate and Startup functions in Dojo and I am getting difficulties to understand these two function in widget life cycle.

I did google and read in dojo documentation but no luck. Can someone explain it with lucid example.


Solution

  • That's simple , those method come with every widget that extend or inherit the WidgetBase dojo class ,

    Dojo widget passes thorough different life cycle method , among those we find the last two method postCreate and 'startup' ,

    if you want postCreate comes just before startup in lifecycle , note that postCreate just finished to create your widget but may not yet attached to dom , also its child widget not mounted ,

    On the other hand the startup come after widget rendrer with it's child widgets and mounted to dom.

    so if you have any layout calculation , or dom related function , you may not use postCreate for this , and should use staartup to ensure widget has finished mounting to DOM

    Read more in Doc