Let's say we have an
immediate="false", and no
apex:actionSupport. It's just a standard
apex:commandButton inside an
Additionally, suppose it has a
reRender attribute which rerenders some form elements.
This page leaves out an important detail:
Namely, when the various form elements are rerendered, you may imagine that some of them will call methods on the controller. For example, there may be some methods called to retrieve Boolean values to control the
"rendered" attribute of certain elements. Additionally, elements such as
apex:selectOptions may call methods on the controller to retrieve
List<T> for their
Is there any defined order for these method calls, or is it non-deterministic?
Here is one of my use cases where this is important. I have an
apex:selectOptions which calls a controller action in its
"value" attribute. Let's call this action
"getOptions()". This must be run at postback time, as its contents are sensitive to certain controller member variables that are assigned by input elements during the postback. Also, I have some sections on the page that either render, or do not, depending upon whether
"getOptions()" contains any data.
It would be ideal not to have to make 2 SOQL queries, one for the List and the other to retrieve a
COUNT() aggregate, using the same predicate, but I can't see another option, since
getOptions() may not have been called by the time the other element needs to know how many options were returned. It seems I need another method,
getOptionCount() in order to be guaranteed to get the count.