You need to sign in to do that
Don't have an account?
Leuwend Job Hapa
Attributes Exection Order
I have a custom component below which has many attributes:
<c:SampleComponent sortBy="Type" storeTo="page2:hidden" isTableFormat="true"/>How will I know which of the setter methods of each attributes executes first? Thanks!
This is documented behaviour - see:
http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_methods.htm
In the setter section, it states (bold is mine):
It’s a best practice for setter methods to be idempotent, that is, to not have side effects. For example, don’t increment a variable, write a log message, or add a new record to the database. Visualforce doesn’t define the order in which setter methods are called, or how many times they might be called in the course of processing a request. Design your setter methods to produce the same outcome, whether they are called once or multiple times for a single page request.
All Answers
1. constructor methods run.
2. attributes expressions are evaluated.
3. executes any assignTo attributes.
4. evaluates action method and executes all other method calls
Some helpful links which I can gather related to this :
http://salesforce.stackexchange.com/questions/34684/getters-and-setters-order-in-a-visualforce-component
http://salesforce.stackexchange.com/questions/9941/setter-method-in-vf-component-being-called-after-the-constructor-has-retured
http://bobbuzzard.blogspot.in/2011/05/updating-attributes-in-component.html
This is documented behaviour - see:
http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_methods.htm
In the setter section, it states (bold is mine):
It’s a best practice for setter methods to be idempotent, that is, to not have side effects. For example, don’t increment a variable, write a log message, or add a new record to the database. Visualforce doesn’t define the order in which setter methods are called, or how many times they might be called in the course of processing a request. Design your setter methods to produce the same outcome, whether they are called once or multiple times for a single page request.