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
sherazsheraz 

issue with visualforce page table?

I create a VF page that has 3 table in it and these three table showing as vertical instead of horizontal.i want to display table in the following format:

 Application   
TypeDateByToComments/Notes
App rec    
Com App    
App Assing    
App routed   

 

 

sherazsheraz

here is my code:

<apex:pageBlockSection title="Application" collapsible="false" columns="5">
         <apex:dataTable value="{!OpportunityProduct__c}" var="c" rows="4" border="8" WIDTH="50%"  cellspacing="10" cellpadding="10">
         
         
         <tr>
         <td>
              <apex:column headerValue="Type">
               Application Recieved
              </apex:column>
              <apex:column headerValue="Date">
              <apex:inputField value="{!c.Application_Received__c}"/>
              </apex:column>
              <apex:column headerValue="By">
              <apex:inputField value="{!c.Application_Received_By__c}"/>
              </apex:column>
              <apex:column headerValue="To">
              <apex:inputField value="{!c.Application_Received_To__c}"/>
              </apex:column>
              <apex:column headerValue="Comments/Notes">
              <apex:inputField value="{!c.Comments__c}"/>
              </apex:column>
               </td>
          </tr> 
          
          <tr>
               <apex:column headerValue="Type">
               Complete Application Recieved
               </apex:column>
               <apex:column headerValue="Date">
               <apex:inputField value="{!c.Application_Received_Complete__c}"/>
               </apex:column>
               <apex:column headerValue="By">
               <apex:inputField value="{!c.Application_Received_Complete_By__c}"/>
               </apex:column>
               <apex:column headerValue="To">
               <apex:inputField value="{!c.Application_Received_To__c}"/>
               </apex:column>
               <apex:column headerValue="Comments/Notes">
               <apex:inputField value="{!c.Comments__c}"/>
               </apex:column>
         </tr> 
          
         <tr>
               <apex:column headerValue="Type">
                Application Assigned
               </apex:column>
               <apex:column headerValue="Date">
               <apex:inputField value="{!c.Application_Date_Assigned__c}"/>
               </apex:column>
               <apex:column headerValue="By">
               <apex:inputField value="{!c.Application_Assigned_By__c}"/>
               </apex:column>
               <apex:column headerValue="To">
               <apex:inputField value="{!c.Application_Assigned_To__c}"/>
               </apex:column>
               <apex:column headerValue="Comments/Notes">
               <apex:inputField value="{!c.Comments__c}"/>
               </apex:column>
         </tr> 
           
         <tr>
               <apex:column headerValue="Type">
                Application Routed
               </apex:column>
               <apex:column headerValue="Date">
               <apex:inputField value="{!c.Application_Routed_Date__c}"/>
               </apex:column>
               <apex:column headerValue="By">
               <apex:inputField value="{!c.Application_Routed_By__c}"/>
               </apex:column>
               <apex:column headerValue="To">
               <apex:inputField value="{!c.Application_Routed_To__c}"/>
               </apex:column>
               <apex:column headerValue="Comments/Notes">
               <apex:inputField value="{!c.Comments__c}"/>
               </apex:column>
         </tr> 
 please help me

sherazsheraz

this is screenshot:

Pramod KumarPramod Kumar

You should use "apex:repeat" to generate the desired table.

 

Problem with <apex:datatable> is that you can can't specify <tr> explicitly in it. It creates <tr> itself you just need to define <apex:column> in case of data <apex:datatable>.

 

Another problem in your code is that all your 4 <tr> will display same date, by, to etc information because var c to whom you are referring is same.

 

sherazsheraz

Thanks Pramod for your reply.Asi am new to salesforce could you please show me that what and where in need to change the code. 

can you provide the sample code.

thanks

 

Pramod KumarPramod Kumar

It should be something like this - 

 

<apex:form>
<table border="1">
<apex:variable var="row" value="1"/>
<apex:repeat value="{!OpportunityProduct__c}" var="c"">
<tr>
<apex:outputText rendered="{!if(VALUE(row)=1, true, false)}">
<td>Application Recieved</td>
</apex:outputText>

<apex:outputText rendered="{!if(VALUE(row)=2, true, false)}">
<td>Complete Application Recieved</td>
</apex:outputText>

<apex:outputText rendered="{!if(VALUE(row)=3, true, false)}">
<td>Application Assigned</td>
</apex:outputText>

<apex:outputText rendered="{!if(VALUE(row)=4, true, false)}">
<td>Application Routed</td>
</apex:outputText>

<td>
<apex:inputField value="{!c.Application_Received_Complete__c}"/>
</td>

<td>
<apex:inputField value="{!c.Application_Received_Complete_By__c}"/>
</td>

<td>
<apex:inputField value="{!c.Application_Received_To__c}"/>
</td>

<td>
<apex:inputField value="{!c.Comments__c}"/>
</td>
</tr>

<apex:variable var="row" value="{!VALUE(row)+1}"/>

</apex:repeat>
</table></apex:form>