Wrapper class displaying Int and String data types

Continued ...! Displaying boolean and list data types
Continued ...! Wrapper Basics



Visualforce Page


<apex:page sidebar="false" controller="WrapperIntStringDisplayClassTest">
  <apex:form >
      <apex:pageBlock >
          <apex:pageBlockSection >
              <apex:pageBlockTable value="{!lstwrapperIntString}" var="w">
                      <apex:column headervalue="Action">
                          <apex:inputcheckbox />
                      </apex:column>
                      <apex:column headervalue="TestingName">
                          {!w.Tname}
                      </apex:column>
                      <apex:column headerValue="TestingCity">
                          {!w.Tcity}
                      </apex:column>
                      <apex:column headervalue="DataLoadCountry">
                          {!w.Dcountry}
                      </apex:column>
                      <apex:column headerValue="DataLoadPhone">
                          {!w.Dphone}
                      </apex:column>
              </apex:pageBlockTable>
          </apex:pageBlockSection>
      </apex:pageBlock>
  </apex:form>
</apex:page>

Apex Class

public with sharing class WrapperIntStringDisplayClassTest {
    List<Testing__c> lsttest = new List<Testing__c>();
    List<DataLoadTest__c> lstdlt = new List<DataLoadTest__c>();
    public List<wrapper> lstw = new List<wrapper>(); 

    public List<wrapper> getLstwrapperIntString() {
        lsttest = [select name,city__c from Testing__c];
        lstdlt = [select country__c,phone__c from DataLoadTest__c];
        for(Integer i=0;i<lstdlt.size();i++){
            lstw.add(new wrapper(lsttest[i].name,lsttest[i].city__c,lstdlt[i].country__c,
            lstdlt[i].phone__c));
        }
        return lstw;
    }        
    public class wrapper{
        public String Tname{get;set;}
        public String Tcity{get;set;}
        public String Dcountry{get;set;}
        public String Dphone{get;set;}
        
        public wrapper(String Tname,String Tcity,String Dcountry,String Dphone){
            this.Tname=Tname;
            this.Tcity=Tcity;
            this.Dcountry=Dcountry;
            this.Dphone=Dphone;
        }
 } }
Wrapper class displaying Int and String data types Wrapper class displaying Int and String data types Reviewed by dasfrogpractice on 08:04 Rating: 5

No comments:

Theme images by mariusFM77. Powered by Blogger.
Youtube Channel Image
Dasfrog Subscribe To watch more Salesforce Training
Subscribe