I am currently very stuck on some logic concerning a visualforce page and it's controller.
Say I have the following code (I don't have any example code because I am stuck without any idea of how to proceed with this problem):
<apex:repeat value="{!some-record-list}" var="record">
<div style="{!IF(CONDITION_A, '', 'none')}">
<!-- Lots of code here that processes various sObject fields on the record and displays various info, requires a lot of memory -->
</div>
<div style="{!IF(CONDITION_B, '', 'none')}">
<!-- Different, but equally if not more memory requiring code here -->
</div>
<!-- undefined number of varying divs, not similar enough to make a component, but considerably similar -->
</apex:repeat>
It seems as if, even though some of the above divs are not rendered because of the conditioning, the memory requirement is equivalent to the memory requirement of all of the divs, instead of just the ones rendered.
My question is, how do I go about cleaning this up, so that only the code that fits the conditions appears in the page, so that the memory usage could be dramatically decreased?
I've thought about using apex:outputText escape="false"... However I don't think I can pass parameters from outputText to the controller, which is necessary because of the apex:repeat, I need to process specific information to the current record in the repeat. I also cannot store the current iteration's record into a page parameter or into a variable on the controller, because users will be able to manipulate any fields within the divs at any time.
So... Is there a way to make it so code on the visualforce page is completely ignored if a condition is true? I.e. the presence of that code has no effect on memory/cpu usage at all?