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
himanshu huske 7himanshu huske 7 

please correct my code

this page i wanna create, please correct the  codeUser-added image
 
<apex:page standardController="Sales_Office__c"  docType="html-5.0" tabStyle="Sales_Office__c" extensions="Claim_Property_from_Sales_Region" recordSetVar="wrapperRecordList">
  <apex:sectionHeader title="Sales Office" subtitle="{!Sales_Office__c.Sales_Office_Name__c}" />
   <apex:form title="{!Sales_Office__c.Sales_Office_Name__c}"> 
   <apex:pageBlock title="Sales Office" rendered="{!wrapperRecordList.size!=0}" id="pbId" >
   <apex:commandButton label="Calim Property" value={!claimProp}/>>
    <apex:commandButton label="Calim and countinue" value={!claimAndCountinue}/>>
     <apex:commandButton label="Cancel" value={!Cancel}/>>
    <apex:pageBlockTable value="{!wrapperRecordList}" var="cont">
           <apex:column headerValue="Select">
             <apex:inputCheckbox value="{!p.isSelected}"/>
           </apex:column>
           <apex:column headerValue="Property">
             <apex:outputField value="{!p.prop.Property_Name__c}"/>
           </apex:column>
           <apex:column headerValue="Property City">
             <apex:outputField value="{!p.prop.Property_City__c}"/>
           </apex:column>
           <apex:column headerValue="List Price">
            <apex:outputField value="{!p.pop.Listing_Price__c}"/>
           </apex:column>
           <apex:column headerValue="Status">
            <apex:outputField value="{!p.pop.Status__c}"/>
           </apex:column>
           <apex:column headerValue="Date Added">
            <apex:outputField value="{!p.pop.createdDate}"/>
           </apex:column>
       </apex:pageBlockTable>       
    <apex:outputPanel style="text-align:center;" layout="block">
          <apex:commandButton value="First" reRender="pbId" action="{!first}" disabled="{!NOT(hasPrevious)}" status="paginationStatus"/>
          <apex:commandButton value="Previous" rerender="pbId" action="{!previous}" disabled="{!NOT(hasPrevious)}" status="paginationStatus"/>&nbsp;Page {!pageNumber} of {!totalPages}&nbsp;
          <apex:commandButton value="Next" rerender="pbId" action="{!next}" disabled="{!NOT(hasNext)}" status="paginationStatus"/>
          <apex:commandButton value="Last" rerender="pbId" action="{!last}" disabled="{!NOT(hasNext)}" status="paginationStatus"/>
          <apex:actionStatus id="paginationStatus">
             <apex:facet name="start">
                 Please wait...<img src="/img/loading32.gif" style="width: 18px;"/>
             </apex:facet>
          </apex:actionStatus>
          </apex:outputPanel>
     </apex:pageBlock>
   </apex:form>
</apex:page>



public class Claim_Property_from_Sales_Region {
   
   Public Integer size{get;set;}
 Public Integer noOfRecords{get; set;}
 public List<SelectOption> paginationSizeOptions{get;set;}
 public static final Integer QUERY_LIMIT = 10000;
 public static final Integer PAGE_SIZE = 5;
 public List <WrapperClass> wrapperRecordList{get;set;}
 Map<Id, WrapperClass> mapHoldingSelectedRecords{get;set;}
 
 public Claim_Property_from_Sales_Region (ApexPages.StandardSetController con){
 }
 
 public Claim_Property_from_Sales_Region(){
   mapHoldingSelectedRecords = new Map<Id, WrapperClass>();
   init();

//Init method which queries the records from standard set controller.
 public void init() {
 wrapperRecordList = new List<WrapperClass>();
 for (Property__c p : (List<Property__c>)setCon.getRecords()) {
 if(mapHoldingSelectedRecords != null && mapHoldingSelectedRecords.containsKey(p.id)){
 wrapperRecordList.add(mapHoldingSelectedRecords.get(p.id));
 
 }
 else{
   wrapperRecordList.add(new WrapperClass(p, false));
 }
 }
 } 
 
   /** Instantiate the StandardSetController from a query locater*/  
   public ApexPages.StandardSetController setCon {
 get {
 if(setCon == null) {
   setCon = new ApexPages.StandardSetController(Database.getQueryLocator([SELECT Property_Name__c,Property_City__c, Listing_Price__c, Status__c,createdDate FROM Property__c where Status__c = 'open' LIMIT : QUERY_LIMIT ]));
 // sets the number of records to show in each page view
   setCon.setPageSize(PAGE_SIZE);
 }
   return setCon;
 }
 set;
 }
 public Boolean hasNext {
 get {
   return setCon.getHasNext();
 }
 set;
 }
 
 /** indicates whether there are more records before the current page set.*/
 public Boolean hasPrevious {
 get {
   return setCon.getHasPrevious();
 }
 set;
 }
 
 /** returns the page number of the current page set*/
 public Integer pageNumber {
 get {
   return setCon.getPageNumber();
 }
 set;
 }
 /** return total number of pages for page set*/
   Public Integer getTotalPages(){
     Decimal totalSize = setCon.getResultSize();
     Decimal pageSize = setCon.getPageSize();
     Decimal pages = totalSize/pageSize;
     return (Integer)pages.round(System.RoundingMode.CEILING);
 }
 
 /** returns the first page of the page set*/
 public void first() {
   updateSearchItemsMap();
   setCon.first();
   init();
 }
 
 /** returns the last page of the page set*/
 public void last() {
   updateSearchItemsMap();
   setCon.last();
   init();
 }
 /** returns the previous page of the page set*/
 public void previous() {
   updateSearchItemsMap();
   setCon.previous();
   init();
 }
 
 /** returns the next page of the page set*/
 public void next() {
   updateSearchItemsMap();
   setCon.next();
   init();
 }
 //This is the method which manages to remove the deselected records, and keep the records which are selected in map.
 private void updateSearchItemsMap() {
 for(WrapperClass wrp : wrapperRecordList){
  if(wrp.isSelected){
     mapHoldingSelectedRecords.put(wrp.prop.id, wrp);
  }
  if(wrp.isSelected == false && mapHoldingSelectedRecords.containsKey(wrp.prop.id)){
     mapHoldingSelectedRecords.remove(wrp.prop.id);
  }
 }
 }
 public class WrapperClass {
 public Boolean isSelected {get;set;}
 public Property__c prop {get;set;}
 public WrapperClass(Property__c prop, Boolean isSelected) {
    this.prop = prop;
    this.isSelected = isSelected;
 }
 }
}