Problem: When utilizing a pageBlockTable to create a calendar, I am unable to conditionally display components in certain locations.
Right now I'm using this set up to populate my calendar:
<apex:pageBlockTable value="{!calendar}" var="a" rules="all" cellpadding="75%">
<apex:column >
<apex:facet name="header">SUNDAY<br/>(Morning)</apex:facet>
<apex:outputText value="{!a.Sunday[0].viewDate}"></apex:outputText>
<apex:inputCheckbox value="{!a.Sunday[0].isChecked}"></apex:inputCheckbox>
</apex:column>
<apex:column >
<apex:facet name="header"><br/>(Afternoon)</apex:facet>
<apex:outputText value="{!a.Sunday[1].viewDate}"></apex:outputText>
<apex:inputCheckbox value="{!a.Sunday[1].isChecked}"></apex:inputCheckbox>
</apex:column>
</apex:pageBlockTable>
This works well, however it will place checkboxes in every single square, even those without actual dates. Example:
When I attempt to use a flag from the controller and use an apex:variable element paired with render=flag to say whether or not a box should appear, it will remove the checkbox for the entire column rather than just for one row. Like this:
<apex:pageBlockTable value="{!calendar}" var="a" rules="all" cellpadding="75%">
<apex:column >
<apex:facet name="header">SUNDAY<br/>(Morning)</apex:facet>
<apex:outputText value="{!a.Sunday[0].viewDate}"></apex:outputText>
<apex:variable value="{!foo}" var="bar" rendered="{!a.Sunday[0].displayBox}" >
<apex:inputCheckbox value="{!a.Sunday[0].isChecked}"></apex:inputCheckbox>
<apex:variable>
</apex:column>
<apex:column >
<apex:facet name="header"><br/>(Afternoon)</apex:facet>
<apex:outputText value="{!a.Sunday[1].viewDate}"></apex:outputText>
<apex:variable value="{!foo}" var="bar" rendered="{!a.Sunday[1].displayBox}" >
<apex:inputCheckbox value="{!a.Sunday[1].isChecked}"></apex:inputCheckbox>
</apex:variable>
</apex:column>
<apex:pageBlockTable>
How else can I approach this problem? Thanks
rendered
attribute of the checkbox itself like<apex:inputCheckbox rendered="{!Expression}"
.