8

I want to render an outputpanel if list is not null.

<apex:outputPanel id="opformofauth" style="width:100%" rendered="{!lstPersonWrapper != null}">
....
</apex:outputpanel>

This is not working as expected

1
  • btw you can also use not(lstPersonWrapper.isempty) Oct 23, 2013 at 7:31

4 Answers 4

9
     <apex:outputPanel id="opformofauth" style="width:100%" rendered="{!lstPersonWrapper.size!=0}">
</apex:outputpanel>
0
9

I would try to use the function ISBLANK to determine if the list is blank or null:

<apex:outputPanel id="opformofauth" 
                  style="width:100%" 
                  rendered="{!NOT(ISBLANK(lstPersonWrapper))}">
    ...
</apex:outputpanel>

Additionaly you can check whether the list has any enties:

<apex:outputPanel rendered="{!NOT(ISBLANK(lstPersonWrapper))}">
    <apex:outputPanel id="opformofauth" 
                      style="width:100%" 
                      rendered="{!lstPersonWrapper.size != 0}">
        ...
    </apex:outputpanel>
</apex:outputPanel>"
1

Render it like as:

<apex:outputPanel id="opformofauth">
    <apex:outputPanel  style="width:100%" rendered="{!lstPersonWrapper != null}">
       ....
    </apex:outputpanel>
</apex:outputpanel>
0

Here is the code to render component if list is not null and not empty

<apex:outputPanel rendered="{!objList != null && !objList.empty}">Test</apex:outputPanel>

You must log in to answer this question.

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