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
prashanthreddypalnatiprashanthreddypalnati 

finding bugs....

public class AllAccounts
{
    public list<Account> acc{get;set;}
    public integer selected{get;set;}
    public list<InnerClass> allaccWrapper{get;set;}
    public boolean unck;
    public AllAccounts()
    {
        unck = false;
        allaccWrapper = new list<InnerClass>();
        acc = [select id,name from Account];
        for(integer i = 0;i<acc.size();i++)
        {
           InnerClass innclas = new InnerClass(acc[i],unck);
           allaccWrapper.add(innclas);
        }
    }
    
    
    public void chckcount()
    {
        selected = 0;
        for(integer i =0;i<allaccWrapper.size();i++)
        {
            if(allaccWrapper[i].tounchk == true)
            {
                selected = selected +1;
            }
        }
    }
    
    
    public void SelectAll()
    {
        for(integer i =0;i<allaccWrapper.size();i++)
        {
            allaccWrapper[i].tounchk  = true;
        }
    }
    
    public class InnerClass
    {
        public account toacc{get;set;}
        public boolean tounchk{get;set;}
        
        public InnerClass(Account fromacc,boolean fromunchk)
        {
             toacc = fromacc;
             tounchk = fromunchk;
        }
    }
}


<apex:page controller="AllAccounts">
  <apex:form>
      <apex:pageBlock>
          <apex:pageBlockTable value="{!allaccWrapper}" var="allAccounts">
              <apex:column headerValue="Allchk">
                 <apex:inputCheckbox value="{!allAccounts.tounchk}"/>
               </apex:column>
              <apex:column headerValue="ID">
                  <apex:outputText>{!allAccounts.toacc.id}</apex:outputText>
               </apex:column>
                <apex:column headerValue="Name">
                  <apex:outputText>{!allAccounts.toacc.Name}</apex:outputText>
               </apex:column>
          </apex:pageBlockTable>
          HAI SELCTED COUNT IS HERE==><apex:outputText>{!selected}</apex:outputText>
          <apex:commandButton value="selectedcount" action="{!chckcount}"/>
           <apex:commandButton value="selectAll" action="{!SelectAll}"/>
      </apex:pageBlock>
  </apex:form>-
</apex:page>

 way the code execut........from where to where.........help me out please...........

rohitrrohitr

Could you specifically tell what is the issue with this code?

prashanthreddypalnatiprashanthreddypalnati
hi rohit not having issues with this code..........but just want to know the execution and flow of the program....... thnx. -- Prashanthreddy Palnati
Rahul_sgRahul_sg

AllAccounts is a controller class and it is used by a VF page (code you provided), you can execute this by typing the following URL in your browser : https://(your salesforce server e.g. na2.salesforce.com in case of na2 server)/apex/(name of VF page)

<apex:page controller="AllAccounts">
  <apex:form>
      <apex:pageBlock>
          <apex:pageBlockTable value="{!allaccWrapper}" var="allAccounts">
              <apex:column headerValue="Allchk">
                 <apex:inputCheckbox value="{!allAccounts.tounchk}"/>
               </apex:column>
              <apex:column headerValue="ID">
                  <apex:outputText>{!allAccounts.toacc.id}</apex:outputText>
               </apex:column>
                <apex:column headerValue="Name">
                  <apex:outputText>{!allAccounts.toacc.Name}</apex:outputText>
               </apex:column>
          </apex:pageBlockTable>
          HAI SELCTED COUNT IS HERE==><apex:outputText>{!selected}</apex:outputText>
          <apex:commandButton value="selectedcount" action="{!chckcount}"/>
           <apex:commandButton value="selectAll" action="{!SelectAll}"/>
      </apex:pageBlock>
  </apex:form>-
</apex:page>