I need to design a table whose values in specific columns depends on values in a Case
.
My initial visualforce page controller filters the cases so that I end up with a list of just a single type of cases. Lets call these rmcases
.
In my table certain columns are straightforward like "{!rmcases.Subject}"
, "{!rmcases.CaseNumber}"
, etc. However I need to generate a certain number of columns, let say 1 column whose value depends on "{!rmcases.Date__c}"
, for example, the column should show +
if the date is in the future.
Initially I designed a page that looked like:
<apex:pageBlock >
<apex:pageBlockTable value="{!cases}" var="rmcase">
<apex:column value="{!rmcase.CaseNumber}"/>
<apex:column value="{!rmcase.Subject}"/>
<apex:column value="{!rmcase.Status}"/>
<c:rmcomponent case="{!rmcase}" />
</apex:pageBlockTable>
</apex:pageBlock>
The idea being that the component would check the value of date for rmcase
and return a column
. However, this doesn't work because I get that a column
needs to be between pageBlockTable
tags.
The alternative is to have the component generate the whole table but then I get into another issue, which is that I would need to call a method in the controller for rmcase
that would give me the value of the column
.
What would be a best practice solution?
apex:column
in theapex:pageBlockTable
you show in your question? (I know the page would be cleaner if you factored this out into a component but as you have discovered it isn't always possible.)