2

I was wondering if anything has been done about the issue where using 'rendered' in an apex:column prevents the headerValue or facet from being displayed at all.

I haven't been able to find a viable way to make this work from searching.

All I find are people suggesting something like:

<apex:column headerValue="my header">
    <apex:outputText rendered="Some Condition" value="test test"></apex:outputText>
</apex:column>

which is not viable for me. This still displays the column, and will always display the column header. I need to display or hide entire columns, so I want something like this:

<apex:column rendered="Some condition" headerValue=" my header" value="{!item.values}"></apex:column>

But of course the header doesn't seem to want to render when the rendered tag is used... Has anyone found a way to make this work to allow for column headers while hiding/displaying the entire column on some condition?

1

I ended up finding a solution.

Instead of using 'rendered' tag in the apex:column, instead use something like:

style="display:{!If(your condition, 'table-cell','none')}"

This will do the same thing as rendered, your column will be hidden if the condition fails, and visible if it succeeds. But this has the benefit of having headerValue and facets work correctly.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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