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
huniversehuniverse 

Paging issue

hi

 

Following is my code, i am having trouble in paging.

 

Page:

<apex:pageBlock id="MyOpps">
    <apex:dataTable value="{!MyList}" var="aOpp" width="100%" rows="16">

      <apex:column headerValue="Select">
      <apex:inputCheckbox id="selectedcheck"/>
      </apex:column>       
      
      <apex:column headerValue="Id">
             <apex:outputText value="{!aOpp.Id}" id="grdSelectid"/>  
      </apex:column>
       
                               
     <apex:column headerValue="AccountName">
             <apex:outputText value="{!aOpp.Name}" id="grdSelect"/>  
      </apex:column>
         
     
     <apex:column headerValue="Plz">
            <apex:outputText value="{!aOpp.Plz__c}" id="plz"/>
      </apex:column>
    
      
     <apex:column headerValue="Ort">
          <apex:outputText value="{!aOpp.Ort__c}" id="ort"/>
    </apex:column>
     
      
     </apex:dataTable>
     
 </apex:pageBlock>   
 <apex:panelGrid columns="4" id="links">
        <apex:commandLink action="{!first}">First</apex:commandlink>
        <apex:commandLink action="{!previous}">Previous</apex:commandlink>
        <apex:commandLink action="{!next}">Next</apex:commandlink>
        <apex:commandLink action="{!last}">Last</apex:commandlink>
</apex:panelGrid>

 

 

Controller:

 

 

 public List<Account> MyList {get; set;}
      public ApexPages.StandardSetController con {
         get {
            if(con == null) {
               con = new ApexPages.StandardSetController(Database.getQueryLocator([select Id, Name, PLZ__c, Ort__c, Strasse__c, Kundentyp__c,from Account]));
               con.setPageSize(16);
            }
            return con;
        }
        set;
    }

 

 public PageReference genMyList() {
        MyList = bMyList();
         return null;
            }

 

public List<Account> bMyList(){
          List<Account>  con = new List<Account>();
                
                String plzPart ='';
                String sCondition = ' ';
                String sConcate = 'where';               
                
              if (txtPlz != '')
                {
                    sCondition = sCondition +' '+ sConcate + ' PLZ__c = \'' +txtPlz+ '\'';
                   sConcate = ' and ';
                                 
               }
                
                if (txtOrt != '')
                {
                  sCondition = sCondition + ' ' + sConcate + ' Ort__c = \'' +txtOrt+ '\'';
                   sConcate = ' and ';
                }
                
                if(txtStrasse!= '')
               {
                   sCondition = sCondition + ' ' + sConcate + ' Strasse__c = \'' +txtStrasse+ '\'';
                   //sConcate = ' and ';
               }
                        
               
               String qryString = 'select Id, Name, PLZ__c, Ort__c, Strasse__c, Kundentyp__c,from Account ' + sCondition ;
               MyList= Database.query(qryString);
               return MyList;
        }

 

Next,Previous, First, Last button are not working. Kindly guide me in issue through code. If any link available then please suggest me.

 

 

Thanks

vijaymindvijaymind

I think this functionality work only for the apex:pageBlockTable Try to change datatable to PBTable. Otherwise u have to make it manually with wrapper class which will hold the List which ur passing in the datatable.

 

May this wil help u....

 

 

Thnx VJ..

huniversehuniverse

Thanks for reply. My problem is that when i implement that logic to PBTable the search functionality is not working fine. Either of search or paging is working.  So is there any way to sort out that both search and Paging working. Is there any other way to implement Paging in Datatable.  Suggest any good link for paging and searching functionality if possible.

 

 

 

Thanks

Huniverse