Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I have an abstract class and a couple of descendants of that class. When I do an apex:repeat over a list of instances of the abstract class I can't access anything defined solely in the child classes except via dynamic VF bindings.

example vf:

<apex:repeat value="{!abstractobjs}" var="obj">
    <apex:outputpanel layout="none" rendered="{!obj.objectType == 'Child1'}">
        <apex:inputField value="{!obj['inputobj'][obj['inputField']]}" /> 
    </apex:outputpanel>
    <apex:outputpanel layout="none" rendered="{!obj.objectType == 'Child2'}">
        <apex:selectList value="{!obj['selected']}" multiselect="false">
                <apex:selectOptions value="{!obj['options']}"/>
        </apex:selectList>
    </apex:outputpanel>
    ...repeat for many objecttypes
</apex:repeat>

I could define inputobj, inputfield, etc. in the base abstract class and then simply implement them in the child classes but this makes my classes messier than they need to be.

Are there any performance issues (the repeat will be over 100s of objects) or other drawbacks of using dynamic vf bindings for this?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

We do lots of dynamic property bindings like this in VF and haven't experienced any drawbacks. I would expect the work being done under the covers to navigate the object graph being pretty much identical for explicitly named properties and dynamic properties.

Your other option would be to create dynamic VF components in your controller, but that always feels like way too much of a violation of MVC to me.

share|improve this answer
    
As I've mentioned a lot of places as well, with a cloud based platform the chances of the server processing time being the bottleneck in a request are pretty much zero. –  LaceySnr Feb 20 '13 at 5:25
    
Not sure what you mean? It's very easy to push server processing time to a significant (1+ second) portion of request time in Apex. Happens all the time to me. –  jkraybill Feb 20 '13 at 6:24
    
The comment was to provide additional info, not to be in contention with your answer. Sever time can be pushed pretty high but in the majority of cases it's likely to be very small in comparison rest of the request time, though that is heavily dependant on the connection speed of the user of course. –  LaceySnr Feb 20 '13 at 6:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.