+ Start a Discussion
1111_forcecom1111_forcecom 

Método 'ContactStandardController.previous()' desconocido

Hi developers,

I need your help in a page that I want to display. The thing is that my page must be display a list of items with pagination because are so many.

I did this in my page

<apex:page StandardController="Contact" extensions="contactExtension">
    <apex:pageBlock title="Beneficios dolares">
        <apex:form id="theForm">
            <apex:pageBlockSection >
                <apex:dataList value="{!BeneficiosUsd}" var="beneficio" type="1">
                    {!beneficio.monto_estimado__c}
                </apex:dataList>
            </apex:pageBlockSection>
            <apex:panelGrid columns="2">
                <apex:commandLink action="{!previous}">Previous</apex:commandlink>
                <apex:commandLink action="{!next}">Next</apex:commandlink>
            </apex:panelGrid>
        </apex:form>
    </apex:pageBlock>
</apex:page>

And I have this error "Método 'ContactStandardController.previous()' desconocido"

This is my apex class
public class contactExtension {

    private final Contact contact;
    private string idContact;
    private final Moneda__c monedabob;
    private string idMonedabob;
    private final Moneda__c monedausd;
    private string idMonedausd;
    public decimal x {get;set;}
    public decimal totalUsd {get;set;}

    public contactExtension(ApexPages.StandardController contactController) {
       this.contact = (Contact)contactController.getRecord();
       idContact = contact.id;
    }
             
    public List<Beneficio__c> getBeneficiosUsd()
    {
        Moneda__c monedaUsd = [select Name from Moneda__c where Moneda__c.name = 'Dolares'];
        idMonedausd = monedausd.id;
       
        totalUsd = 0;
        for (Beneficio__c ben : [select monto_dolares__c from Beneficio__c where Contacto__c = :idContact and Moneda__c = :idMonedausd]){
            if (ben.monto_dolares__c == null){
                ben.monto_dolares__c = 0;
            }
            else{
                totalUsd = ben.monto_dolares__c + totalUsd;
            }
        }       
        return [select Catalogo_Beneficio__c, Name, Moneda__c, monto_dolares__c, proposito__c,fecha_entrega__c  from Beneficio__c where Contacto__c = :idContact and Moneda__c = :idMonedausd];
    }
}
claperclaper
you haven defined a previous method in your controller try this:
public class contactExtension {

    private final Contact contact;
    private string idContact;
    private final Moneda__c monedabob;
    private string idMonedabob;
    private final Moneda__c monedausd;
    private string idMonedausd;
    public decimal x {get;set;}
    public decimal totalUsd {get;set;}

    public contactExtension(ApexPages.StandardController contactController) {
       this.contact = (Contact)contactController.getRecord();
       idContact = contact.id;
    }

   public void previous()
   {
       //implement previous method here.
    }
             
    public List<Beneficio__c> getBeneficiosUsd()
    {
        Moneda__c monedaUsd = [select Name from Moneda__c where Moneda__c.name = 'Dolares'];
        idMonedausd = monedausd.id;
       
        totalUsd = 0;
        for (Beneficio__c ben : [select monto_dolares__c from Beneficio__c where Contacto__c = :idContact and Moneda__c = :idMonedausd]){
            if (ben.monto_dolares__c == null){
                ben.monto_dolares__c = 0;
            }
            else{
                totalUsd = ben.monto_dolares__c + totalUsd;
            }
        }       
        return [select Catalogo_Beneficio__c, Name, Moneda__c, monto_dolares__c, proposito__c,fecha_entrega__c  from Beneficio__c where Contacto__c = :idContact and Moneda__c = :idMonedausd];
    }
}
you will need to the same for the "next" method.