I am building a table using apex:repeats and html and I would like to stick with the method I currently have, but I am not getting my table to output correctly.

Current code is the following,

<apex:repeat id="firstRepeat" value="{!rowList}" var="row">
  <td align="center"><apex:outputText value="{!row.person}"/></td>
  <apex:repeat id="secondRepeat" value="{!row.rendered}" var="rend" >
    <apex:outputPanel rendered="{!rend}">
          <td class=" no-events" rowspan="1"></td>

And to explain a little more about it, the first repeat is making the rows, where along the left side I have the names populated. Then there is a list for each row that is called "rendered", currently each list is the length of the table because I want to have a bunch of empty boxes, but later there will be boxes with different row spans (for how long an event is), so the rendered list may be shorter.

The outpanel that wraps each element is what is not working. When I take it out, the table is correctly produced with empty boxes (there is more CSS in the backend for the "no-events" class, but that isn't important for now).

Before you ask.... yes, every boolean in the rendered list is true.


Take a look at the documentation for apex:outputPanel, specifically the layout property`. Right now your markup is generating something like:


Try setting the layout property on your apex:outputPanel to none. Another alternative would be to use a "hidden" class:

<apex:repeat id="secondRepeat" value="{!row.rendered}" var="rend" >
    <td class="{!'no-events' & IF(rend, '', ' hidden')}" rowspan="1"></td>

Then some simple css:

.hidden { display: none; }
  • Thanks for the quick response, I'm still new to the whole html/visualforce stuff, I think it's better for me to use the css option you mentioned. I tried compiling what you wrote, but I am getting an error that I can't figure out. Is the IF statement syntax correct? – newuser Jun 5 '15 at 16:22
  • @Connor Oops forgot the closing paren... – Adrian Larson Jun 5 '15 at 16:23
  • My bad, I should have mentioned that I saw that and added it, but the page says: "Incorrect parameter type for function 'IF()'. Expected Boolean, received Object", which doesn't make any sense to me. This is with the addition of the parentheses.... – newuser Jun 5 '15 at 16:26
  • Er, I guess the loop variable is rend, not row.rendered. – Adrian Larson Jun 5 '15 at 16:27

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.