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

  • btw you can also use not(lstPersonWrapper.isempty) – Samuel De Rycke Oct 23 '13 at 7:31
9
     <apex:outputPanel id="opformofauth" style="width:100%" rendered="{!lstPersonWrapper.size!=0}">
</apex:outputpanel>
8

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>

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.