1

I have an interesting problem. I have a visual force component where i am looping through a list of data objects say MenuItem data object for now. Now i populate this list on a property in the visual force component controller. Now on the visual force component, as i loop through the collection, i need to render an output text or menu item of a particular style class based on the menuitem data objects status class variable. I am creating an if statement on the render and the code is not recognizing it. The code is below and it is not compiling on the menuData.menuItemState property. This is a custom object class variable and is not defined as a property on the component controller?

<apex:outputPanel layout="block">
<apex:dataList value="{!lstMenuItemData}}" var="menuData">  
    <div id="subNavContainer">
        <apex:outputText styleClass = "subNavSection selected" 
            value="{!menuData.menuItemDisplayText}" 
            rendered="{!IF(menuData.menuItemState=='S',true,false)}"/>
    </div>
</apex:dataList>
</apex:outputPanel>
2

You should post your class to get a solid response, but make sure the class member is itself an accessible property:

public with sharing SomeController
{
  public MyClass
  {
    public String menuItemState {get; set;}
    // etc.

Also you can simplify your render conditional:

rendered="{!menuData.menuItemState == 'S'}"

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.