0

I have what seems like such a simple task. I have a list that contains two integers (0,1). I'm looping through that list in an apex:pageblockTable. Based on the value I want to render different things. But it's not working.

Controller code

public List<Integer> m_lstNums {get;set;}{m_lstNums = new List<Integer>{0,1};}

Visualforce

 <apex:pageBlockTable value="{!m_lstNums}" var="keyValue">
  <apex:column  headerValue="Description">
    <apex:outputText value="{!If((keyValue == 0), '0','1')}"/>
  </apex:column>
 </apex:pageBlockTable>

If I change the outputText value to be

<apex:outputText value="{!keyValue}"/>

It outputs the 0 and 1 properly. But the first set of code only displays the 1 both times. Like keyValue never equals 0.

1 Answer 1

2

Tried below VF page code

<apex:page controller="Testabc">
    <apex:pageBlock title="My Content">

        <apex:pageBlockTable value="{!m_lstNums}" var="keyValue">
            <apex:column  headerValue="Description">
                <apex:outputText value="{!If((keyValue == 0), '2','3')}"/>
            </apex:column>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

Controller code:

public class Testabc {
public List<Integer> m_lstNums {get;set;}{m_lstNums = new List<Integer>{0,1};}

}

Below is the VF output and it works as you expect. Not sure if you have put all the information in the question

enter image description here

1
  • Thanks RedDevil. I'm still not sure what is wrong. But I commented out all the rest of the columns in my table and it works. So now I'll just have to troubleshoot each column.
    – user4978
    Commented May 19, 2018 at 22:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .