+ Start a Discussion
SAHG-SFDCSAHG-SFDC 

Show Apex command button only if list has values

Hi Users,

I am looking for displaying the Apex command button only if the list that I have has atleast one value Amny suggestions?
 
<script>
                                    function load()
                                    {
                                        window.open("/oppitm/multilineitem.jsp?oppId={!Opportunity.Id}&retURL={!Opportunity.Id}", "_parent");
                                    }
                                </script>
                            <apex:commandButton value="Edit All" oncomplete="load();"/>
This list is created in the Apex Class 
Public List<OpportunityLineItem> ProdList{get;set;}

Advance thanks for seeing the post
Best Answer chosen by SAHG-SFDC
Pankaj MehraPankaj Mehra
Hi SAHG-SFDC

Try rendered attribute on commandbutton
 
<apex:commandButton rendered="{!ProdList.size > 0}"  value="Edit All" oncomplete="load();"/>

Mark this to be the best Anwer if this solution is helpful to you, Kindly let me know in case you need other workaround.
Thanks

All Answers

Pankaj MehraPankaj Mehra
Hi SAHG-SFDC

Try rendered attribute on commandbutton
 
<apex:commandButton rendered="{!ProdList.size > 0}"  value="Edit All" oncomplete="load();"/>

Mark this to be the best Anwer if this solution is helpful to you, Kindly let me know in case you need other workaround.
Thanks
This was selected as the best answer
SAHG-SFDCSAHG-SFDC
Hi Pankaj,

Thanks a lot :)