You need to sign in to do that
Don't have an account?
MTBRider
Help with <apex:param> tag
Can some one help me understand why using the name of the param in the outputText value field does not work:
<apex:pageBlockSection columns="1" id="pbsList"> <apex:pageBlockTable value="{!casesInQ}" id="pbt" var="c" columns="11" columnsWidth="50" width="1200" rowClasses="grey_background, white_background"> <apex:column value="{!c.CaseNumber}"/> <apex:column value="{!c.Priority}"/> <apex:column value="{!c.Subject}" width="400"/> <apex:column value="{!c.Type}" width="200"/> <apex:column value="{!c.Status}"/> <apex:column value="{!c.ContactId}"/> <apex:column value="{!c.OwnerId}"/> <apex:column value="{!c.CreatedDate}"/> <apex:column headerValue="Case Age (hrs)"> <apex:outputText value="{cDt}" > <apex:param name="cDt" value="{!ROUND((NOW() - c.CreatedDate) * 24, 2)}"/> </apex:outputText> </apex:column> </apex:pageBlockTable> </apex:pageBlockSection>
I get a error when saving the page saying the value of the Output is not in a valid format.
If I {0} in the value field of outputText it works fine but, ultimately I want to change the background color of the column based on the age of the case, but using 0 to reference the param in a conditional that says if the age of the case is > 2, make the background red, is never going to eval correctly.
Thanks for your help
Hi,
If you want to mark the cell in red then you may use below :
Here the text would come in red if the case age is greater than 2 days. if you want to the backgroud to be red then you need to modify the background property of the span.
Thanks for the response. It does not answer my question though. I know how to change the color. My question is around why the name attribute of the param tag is not recognized by the outputText tag.
shouldn't the value be {!cDt} not {cDt} ?
You can't use <apex:param> that way. I think <apex:variable> is what you're looking for:
try this:
If you use {!cDt} it wants to find cDt in the controller, so you will get an error that say "myController.cDt not found" when trying to save your page.
I think you are right though, that I want to use <apex:variable> instead. Problem is I am using this in a pageBlockTable and the docs say that <apex:variable> does not support reassignment inside of an iteration component. So maybe I am just hosed and need to come up with some other way of doing this.
Thanks for the response.