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
ckellieckellie 

Table not appearing in VFPage

This table is not appearing when I render the vfpage. What do I need to change in my vf page?

 

<apex:page standardcontroller="PCN_s__c" extensions="pcntable" >
<apex:form >
 <apex:pageBlock >
 <apex:repeat value="{!pcnlist}" var="pcn" >   
   <table> 
        <tr> 
            <td> <apex:outputlabel value="Project Impact"/> </td>
            <td> <apex:outputlabel value="Current Project"/> </td>
            <td> <apex:outputlabel value="Revised Project"/> </td>
            <td> <apex:outputlabel value="Change"/> </td>
            <td> <apex:outputlabel value="Approved"/> </td>
       </tr>
       <tr> 
            <td> <apex:outputlabel value="PROD. LABOR HOURS & COST:"/> </td>
            <td> <apex:inputfield value="{!pcn.Current_PROD_LABOR_HOURS__c}"/> <apex:inputfield value="{!pcn.Current_PROD_LABOR_COST__c}"/> </td>
            <td> <apex:inputfield value="{!pcn.Revised_PROD_LABOR_HOURS__c}"/> <apex:inputfield value="{!pcn.Revised_PROD_LABOR_COST__c}"/> </td>
       </tr>
       <tr>
            <td> <apex:outputlabel value="ENG. LABOR HOURS & COST:"/> </td>
            <td> <apex:inputfield value="{!pcn.Current_ENG_LABOR_HOURS__c}"/> <apex:inputfield value="{!pcn.Current_ENG_LABOR_COST__c}"/> </td>
            <td> <apex:inputfield value="{!pcn.Revised_ENG_LABOR_HOURS__c}"/> <apex:inputfield value="{!pcn.Revised_ENG_LABOR_COST__c}"/> </td>
      </tr>
       <tr>
            <td> <apex:outputlabel value="MATERIAL COST:"/> </td>
            <td> <apex:inputfield value="{!pcn.Current_MATERIAL_COST__c}"/> </td>
            <td> <apex:inputfield value="{!pcn.Revised_MATERIAL_COST__c}"/> </td>
      </tr>
       <tr>
            <td> <apex:outputlabel value="PRINT RELEASE DATE:"/> </td>
            <td> <apex:inputfield value="{!pcn.Current_PRINT_RELEASE_DATE__c}"/> </td>
            <td> <apex:inputfield value="{!pcn.Revised_PRINT_RELEASE_DATE__c}"/> </td>
      </tr>
       <tr>
            <td> <apex:outputlabel value="SCHED. SHIP DATE:"/> </td>
            <td> <apex:inputfield value="{!pcn.Current_SCHED_SHIP_DATE__c}"/> </td>
            <td> <apex:inputfield value="{!pcn.Revised_SCHED_SHIP_DATE__c}"/> </td>
      </tr>
       <tr>
            <td> <apex:outputlabel value="ADDITIONAL COMPONENTS:"/> </td>
            <td> <apex:inputfield value="{!pcn.Current_ADDITIONAL_COMPONENTS__c}"/> </td>
            <td> <apex:inputfield value="{!pcn.Revised_ADDITIONAL_COMPONENTS__c}"/> </td>
      </tr>
       <tr>
            <td> <apex:outputlabel value="TOTAL COST:"/> </td>
            <td> <apex:inputfield value="{!pcn.Current_TOTAL_COST__c}"/> </td>
            <td> <apex:inputfield value="{!pcn.Revised_TOTAL_COST__c}"/> </td>
      </tr>
       <tr>
            <td> <apex:outputlabel value="SELLING PRICE:"/> </td>
            <td> <apex:inputfield value="{!pcn.Current_SELLING_PRICE__c}"/> </td>
            <td> <apex:inputfield value="{!pcn.RevisedSELLING_PRICE__c}"/> </td>
      </tr>
  </table>
</apex:repeat>
</apex:pageBlock>
</apex:form>
</apex:page>
Best Answer chosen by Admin (Salesforce Developers) 
ckellieckellie

I have solved this problem with the change below:

<apex:page standardcontroller="PCN_s__c" extensions="pcntable" action="{!autoRun}">
<apex:form > 
    <apex:pageBlock > 
        <apex:repeat value="{!PCN_s__c}" var="pcn" > 
        <table> 
            <tr><td> 
                <apex:outputlabel value="Project Impact"/> 
                </td> <td> 
                <apex:outputlabel value="Current Project"/>
                 </td> <td> 
                 <apex:outputlabel value="Revised Project"/> 
                 </td> <td> 
                 <apex:outputlabel value="Change"/> 
                 </td> <td> 
                 <apex:outputlabel value="Approved"/> 
          </td> </tr> 
          <tr> <td> 
              <apex:outputlabel value="PROD. LABOR HOURS & COST:"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Current_PROD_LABOR_HOURS__c}"/> 
              <apex:inputfield value="{!pcn.Current_PROD_LABOR_COST__c}"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Revised_PROD_LABOR_HOURS__c}"/> 
              <apex:inputfield value="{!pcn.Revised_PROD_LABOR_COST__c}"/>
        </td> </tr> 
        <tr> <td> 
              <apex:outputlabel value="ENG. LABOR HOURS & COST:"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Current_ENG_LABOR_HOURS__c}"/> 
              <apex:inputfield value="{!pcn.Current_ENG_LABOR_COST__c}"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Revised_ENG_LABOR_HOURS__c}"/> 
              <apex:inputfield value="{!pcn.Revised_ENG_LABOR_COST__c}"/> 
         </td> </tr> 
         <tr> <td> 
              <apex:outputlabel value="MATERIAL COST:"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Current_MATERIAL_COST__c}"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Revised_MATERIAL_COST__c}"/> 
         </td> </tr> 
         <tr> <td> 
              <apex:outputlabel value="PRINT RELEASE DATE:"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Current_PRINT_RELEASE_DATE__c}"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Revised_PRINT_RELEASE_DATE__c}"/> 
         </td> </tr> 
         <tr> <td> 
              <apex:outputlabel value="SCHED. SHIP DATE:"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Current_SCHED_SHIP_DATE__c}"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Revised_SCHED_SHIP_DATE__c}"/> 
          </td> </tr> 
          <tr> <td> 
              <apex:outputlabel value="ADDITIONAL COMPONENTS:"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Current_ADDITIONAL_COMPONENTS__c}"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Revised_ADDITIONAL_COMPONENTS__c}"/> 
              </td> </tr> <tr> <td> <apex:outputlabel value="TOTAL COST:"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Current_TOTAL_COST__c}"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Revised_TOTAL_COST__c}"/> 
         </td> </tr> 
         <tr> <td> 
             <apex:outputlabel value="SELLING PRICE:"/> 
             </td> <td> 
             <apex:inputfield value="{!pcn.Current_SELLING_PRICE__c}"/> 
             </td> <td> 
             <apex:inputfield value="{!pcn.RevisedSELLING_PRICE__c}"/> 
        </td> 
    </tr> 
 </table> 
</apex:repeat> 
</apex:pageBlock> 
</apex:form> 
</apex:page>

 

All Answers

SanjaySSanjayS

Try using  apex:pageBlockTable tag.

ckellieckellie

I tried the pageblocktable tag and it did not work.

empucempuc

Are You sure that variable PCNLIST is properly set? Maybe it is simply empty?

PJayaPJaya

 <apex:pageBlockTable value="{!accwrapperlist}" var="accwr" id="AccTable">       
                  <apex:column >
                      <apex:facet name="header">
                         <apex:inputCheckbox >
                                <apex:actionSupport event="onclick"  onsubmit="checkAll(this)" reRender=""/>
                         </apex:inputCheckbox>
                      </apex:facet>
                        <apex:inputCheckBox value="{!accwr.isSelected}" id="testchk"/>
                  </apex:column>                
                                   
                    <apex:column headerValue="Account ID" width="45%">
                        {!accwr.acc1.Id}
                    </apex:column>                   
                    <apex:column headerValue="Account Name" width="25%">
                        {!accwr.acc1.Name}
                   </apex:column>
     </apex:pageBlockTable>

ckellieckellie

PJaya,

 

Thank you for the sample code, but this is not thte type of table I am looking for. Rather than a table of multiple records, I need a table of multiple fields for one records. Example:

Column A is the category of costs for one record. column two is the existing cost for each category, column c is the cost changes, and column d is cost variance for eacch record.

 

Each cell in the table above is an individual field on a single record.

 

Thanks

Naidu PothiniNaidu Pothini

IF possible can you paste the controller class?

 

ckellieckellie

Here is my apex class:

public with sharing class pcntable {
    
    list<pcn_s__c> pcn;
    
    public pcntable(ApexPages.StandardController controller) {
        pcn = [select id, name, Current_PROD_LABOR_HOURS__c,Current_PROD_LABOR_COST__c,
               Current_ENG_LABOR_HOURS__c, Current_ENG_LABOR_COST__c,Current_MATERIAL_COST__c,
               Current_Scheduled_Ship_Date__c, Current_PRINT_RELEASE_DATE__c,Current_SCHED_SHIP_DATE__c,
                Current_ADDITIONAL_COMPONENTS__c, Current_TOTAL_COST__c, Current_SELLING_PRICE__c, Revised_PROD_LABOR_HOURS__c,
                Revised_PROD_LABOR_COST__c,Revised_ENG_LABOR_HOURS__c,Revised_ENG_LABOR_COST__c,Revised_MATERIAL_COST__c,
                Revised_PRINT_RELEASE_DATE__c, Revised_SCHED_SHIP_DATE__c, Revised_ADDITIONAL_COMPONENTS__c, RevisedSELLING_PRICE__c,
                Revised_TOTAL_COST__c 
                from pcn_s__c where id =
                       :ApexPages.currentPage().getParameters().get('pcn')];
    }
    public List<PCN_s__c> getpcnlist()
    {
         for(pcn_s__c c : [select id, name, Current_PROD_LABOR_HOURS__c, Current_PROD_LABOR_COST__c, Current_ENG_LABOR_COST__c,
                             Current_MATERIAL_COST__c, Current_PRINT_RELEASE_DATE__c, Current_ADDITIONAL_COMPONENTS__c,
                             Current_SCHED_SHIP_DATE__c, Current_TOTAL_COST__c, Current_SELLING_PRICE__c, Revised_PROD_LABOR_HOURS__c,
                             Revised_PROD_LABOR_COST__c,Revised_ENG_LABOR_HOURS__c,Revised_ENG_LABOR_COST__c,Revised_MATERIAL_COST__c,
                             Revised_PRINT_RELEASE_DATE__c, Revised_SCHED_SHIP_DATE__c, Revised_ADDITIONAL_COMPONENTS__c,
                             RevisedSELLING_PRICE__c, Revised_TOTAL_COST__c 
                             from pcn_s__c where id =: pcn]){
         }
    return pcn;
    }
}

 Thanks

PJayaPJaya

hope above apex class /contoller helps u

 

 

Naidu PothiniNaidu Pothini
Visualforce Page:

<apex:page standardcontroller="PCN_s__c" extensions="pcntable" action="{!autoRun}"> <apex:form > <apex:pageBlock > <apex:repeat value="{!pcnlist}" var="pcn" > <table> <tr> <td> <apex:outputlabel value="Project Impact"/> </td> <td> <apex:outputlabel value="Current Project"/> </td> <td> <apex:outputlabel value="Revised Project"/> </td> <td> <apex:outputlabel value="Change"/> </td> <td> <apex:outputlabel value="Approved"/> </td> </tr> <tr> <td> <apex:outputlabel value="PROD. LABOR HOURS & COST:"/> </td> <td> <apex:inputfield value="{!pcn.Current_PROD_LABOR_HOURS__c}"/> <apex:inputfield value="{!pcn.Current_PROD_LABOR_COST__c}"/> </td> <td> <apex:inputfield value="{!pcn.Revised_PROD_LABOR_HOURS__c}"/> <apex:inputfield value="{!pcn.Revised_PROD_LABOR_COST__c}"/> </td> </tr> <tr> <td> <apex:outputlabel value="ENG. LABOR HOURS & COST:"/> </td> <td> <apex:inputfield value="{!pcn.Current_ENG_LABOR_HOURS__c}"/> <apex:inputfield value="{!pcn.Current_ENG_LABOR_COST__c}"/> </td> <td> <apex:inputfield value="{!pcn.Revised_ENG_LABOR_HOURS__c}"/> <apex:inputfield value="{!pcn.Revised_ENG_LABOR_COST__c}"/> </td> </tr> <tr> <td> <apex:outputlabel value="MATERIAL COST:"/> </td> <td> <apex:inputfield value="{!pcn.Current_MATERIAL_COST__c}"/> </td> <td> <apex:inputfield value="{!pcn.Revised_MATERIAL_COST__c}"/> </td> </tr> <tr> <td> <apex:outputlabel value="PRINT RELEASE DATE:"/> </td> <td> <apex:inputfield value="{!pcn.Current_PRINT_RELEASE_DATE__c}"/> </td> <td> <apex:inputfield value="{!pcn.Revised_PRINT_RELEASE_DATE__c}"/> </td> </tr> <tr> <td> <apex:outputlabel value="SCHED. SHIP DATE:"/> </td> <td> <apex:inputfield value="{!pcn.Current_SCHED_SHIP_DATE__c}"/> </td> <td> <apex:inputfield value="{!pcn.Revised_SCHED_SHIP_DATE__c}"/> </td> </tr> <tr> <td> <apex:outputlabel value="ADDITIONAL COMPONENTS:"/> </td> <td> <apex:inputfield value="{!pcn.Current_ADDITIONAL_COMPONENTS__c}"/> </td> <td> <apex:inputfield value="{!pcn.Revised_ADDITIONAL_COMPONENTS__c}"/> </td> </tr> <tr> <td> <apex:outputlabel value="TOTAL COST:"/> </td> <td> <apex:inputfield value="{!pcn.Current_TOTAL_COST__c}"/> </td> <td> <apex:inputfield value="{!pcn.Revised_TOTAL_COST__c}"/> </td> </tr> <tr> <td> <apex:outputlabel value="SELLING PRICE:"/> </td> <td> <apex:inputfield value="{!pcn.Current_SELLING_PRICE__c}"/> </td> <td> <apex:inputfield value="{!pcn.RevisedSELLING_PRICE__c}"/> </td> </tr> </table> </apex:repeat> </apex:pageBlock> </apex:form> </apex:page> Controller:
public with sharing class pcntable { public List<pcn_s__c> pcnList { get; set; } public String recordId { get; set; } public pcntable(ApexPages.StandardController controller) {} public void autoRun() { recordId = ApexPages.currentPage().getParameters().get('pcn')]; pcnList = [SELECT Id, Name, Current_PROD_LABOR_HOURS__c,Current_PROD_LABOR_COST__c, Current_ENG_LABOR_HOURS__c, Current_ENG_LABOR_COST__c,Current_MATERIAL_COST__c, Current_Scheduled_Ship_Date__c, Current_PRINT_RELEASE_DATE__c,Current_SCHED_SHIP_DATE__c, Current_ADDITIONAL_COMPONENTS__c, Current_TOTAL_COST__c, Current_SELLING_PRICE__c, Revised_PROD_LABOR_HOURS__c, Revised_PROD_LABOR_COST__c,Revised_ENG_LABOR_HOURS__c,Revised_ENG_LABOR_COST__c,Revised_MATERIAL_COST__c, Revised_PRINT_RELEASE_DATE__c, Revised_SCHED_SHIP_DATE__c, Revised_ADDITIONAL_COMPONENTS__c, RevisedSELLING_PRICE__c, Revised_TOTAL_COST__c FROM pcn_s__c WHERE Id = :recordId]; } }

 try this... let me know if it doesnt work.

ckellieckellie

This is not working. I think it is because I am trying to add a new record rather than editing a record.

ckellieckellie

I have solved this problem with the change below:

<apex:page standardcontroller="PCN_s__c" extensions="pcntable" action="{!autoRun}">
<apex:form > 
    <apex:pageBlock > 
        <apex:repeat value="{!PCN_s__c}" var="pcn" > 
        <table> 
            <tr><td> 
                <apex:outputlabel value="Project Impact"/> 
                </td> <td> 
                <apex:outputlabel value="Current Project"/>
                 </td> <td> 
                 <apex:outputlabel value="Revised Project"/> 
                 </td> <td> 
                 <apex:outputlabel value="Change"/> 
                 </td> <td> 
                 <apex:outputlabel value="Approved"/> 
          </td> </tr> 
          <tr> <td> 
              <apex:outputlabel value="PROD. LABOR HOURS & COST:"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Current_PROD_LABOR_HOURS__c}"/> 
              <apex:inputfield value="{!pcn.Current_PROD_LABOR_COST__c}"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Revised_PROD_LABOR_HOURS__c}"/> 
              <apex:inputfield value="{!pcn.Revised_PROD_LABOR_COST__c}"/>
        </td> </tr> 
        <tr> <td> 
              <apex:outputlabel value="ENG. LABOR HOURS & COST:"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Current_ENG_LABOR_HOURS__c}"/> 
              <apex:inputfield value="{!pcn.Current_ENG_LABOR_COST__c}"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Revised_ENG_LABOR_HOURS__c}"/> 
              <apex:inputfield value="{!pcn.Revised_ENG_LABOR_COST__c}"/> 
         </td> </tr> 
         <tr> <td> 
              <apex:outputlabel value="MATERIAL COST:"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Current_MATERIAL_COST__c}"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Revised_MATERIAL_COST__c}"/> 
         </td> </tr> 
         <tr> <td> 
              <apex:outputlabel value="PRINT RELEASE DATE:"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Current_PRINT_RELEASE_DATE__c}"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Revised_PRINT_RELEASE_DATE__c}"/> 
         </td> </tr> 
         <tr> <td> 
              <apex:outputlabel value="SCHED. SHIP DATE:"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Current_SCHED_SHIP_DATE__c}"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Revised_SCHED_SHIP_DATE__c}"/> 
          </td> </tr> 
          <tr> <td> 
              <apex:outputlabel value="ADDITIONAL COMPONENTS:"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Current_ADDITIONAL_COMPONENTS__c}"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Revised_ADDITIONAL_COMPONENTS__c}"/> 
              </td> </tr> <tr> <td> <apex:outputlabel value="TOTAL COST:"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Current_TOTAL_COST__c}"/> 
              </td> <td> 
              <apex:inputfield value="{!pcn.Revised_TOTAL_COST__c}"/> 
         </td> </tr> 
         <tr> <td> 
             <apex:outputlabel value="SELLING PRICE:"/> 
             </td> <td> 
             <apex:inputfield value="{!pcn.Current_SELLING_PRICE__c}"/> 
             </td> <td> 
             <apex:inputfield value="{!pcn.RevisedSELLING_PRICE__c}"/> 
        </td> 
    </tr> 
 </table> 
</apex:repeat> 
</apex:pageBlock> 
</apex:form> 
</apex:page>

 

This was selected as the best answer