function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

How to create a button that does not require selecting items on list?

<apex:page standardController="PaymentExport__c" tabStyle="DemoPage__tab" showHeader="true" recordSetVar="pex" extensions="DemoPageController"> <apex:sectionHeader title="Payments" /> <apex:ListViews type="PaymentExport__c" > <apex:facet name="header"> <apex:form > <div style="text-align: center; padding-top: 1px"> <apex:commandButton value="New Payment" action="{!create}" id="btnSave" / > </div> </apex:form> </apex:facet> </apex:ListViews> </apex:page>


I have New Payment button in header of listviews but it asks to select a row.

Can I do something about that?


I think that is due to the commandButton being embedded within a ListView component. The error is inferring that the button is acting on behalf of a list.


Try moving the commandButton before the apex:Listviews component. Worth a shot. If not, can you please post your controller's constructor? Thanks. 

If I put it above list it works. The thing is that I would like to reproduce the look and feel salesforce users are used to.