function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion 

Using <apex:repeat> to create dynamic columns

Hey all,


What I am trying to do here is create dynamic columns based on some attributes. However, I am getting a complaint that <apex:column> needs to be the direct child of <apex:pageTable>. Is there any way I can get those columns to repeat through the object's attributes? I found one solution that uses standard HTML <table>'s, etc, but that loses all the SF formatting, which is very important on this project.


Here is what I was trying:


<apex:repeat value="{!AttrDefs}" var="attr">
    <apex:facet name="header">
<apex:outputLabel value="{!attr.Name}"/>
</apex:facet> <apex:inputText value="{!row.col1}" /> </apex:column> </apex:repeat>

Thanks for suggestions!


Why don't you try with apex:dataTable

You can have more info in http://yourorg/apexpages/apexcomponents.apexp

There you will find all the info about apex components.



Unfortunately, it still throws the same direct child error:


ErrorError: <apex:column> must be the direct child of either <apex:dataTable> or <apex:pageBlockTable>

Post all your code.  (And look at the   heaverValue   atribute on apex:column which might be used instead of your header facet.


This isn't going to be possible today. We are working on supporting this (as well as some other features to support "dynamic binding") for the Winter '11 release. Stay tuned...





Doesn't look like this made it in Winter 11. about Spring 11, pretty please. :-D


Unfortunately we couldn't get this to GA for Winter '11. We are making it avaialble selectively as a pilot feature, however. After the Winter '11 release, feel free to contact me and I'll see what I can do.


Any updates ? We are maintaining a bunch of very hard to maintain code just because of this