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
Ripsaw777Ripsaw777 

Issues with Multiple Datatable Rows

Greetings all

 

Im looking for some assistance with formatting issues related to a DataTable if you review this link:

http://postimage.org/image/lczirvrf5/

 

You will see that the rows seem to be extending out to the right and not underneath the current row. The only way Ive been able to display each row below is to create a new DataTable underneath the current one which seems to be the wrong way to go. Can someone offer a suggestion as to how to display row after row of data? We have a check box and a basic text string which we are using to capture followups with clients.

 

Thanks

Ian

 

<apex:pageBlockSection title="1) Access Performance (check only boxes that apply to this visit)" columns="1" >
<apex:dataTable value="{!sitevisit}" var="sitevisit" columns="2" columnswidth="40%,60%" align="CENTER" cellpadding="3" border="1" bgcolor="#A9D0F5">
<apex:column headerValue="Confirmed">
<apex:inputCheckbox value="{!sitevisit.Checklist_1a__c}"/>
</apex:column>
<apex:column headerValue="Requirement">
<apex:outputField value="{!sitevisit.X1a__c}"/ >
</apex:column>
<apex:column >
<apex:inputCheckbox value="{!sitevisit.Checklist_1a__c}"/>
</apex:column>
<apex:column >
<apex:outputField value="{!sitevisit.X1a__c}"/ >
</apex:column>
</apex:datatable>

</apex:pageBlockSection>

Avi646Avi646

Well it seems like you have repaeted these

<apex:column headerValue="Confirmed">
       <apex:inputCheckbox value="{!sitevisit.Checklist_1a__c}"/>
</apex:column>
<apex:column headerValue="Requirement">
       <apex:outputField value="{!sitevisit.X1a__c}"/ >
</apex:column>

 twice!

Rows will automatically get created according to the data present in sitevisit variable. Which should be a list variable.if you add more values in sitevisit  variable rows will appear below the 1st row.

 

Navatar_DbSupNavatar_DbSup

Hi,

 

Make use of "value" attribute to bind your values

Here is a small demo code using data table

<apex:page controller="DatatableDemo">
<apex:dataTable value="{!Con}" var="m" columnswidth="100px,100px" cellpadding="4" border="1">

<apex:column headervalue="ID" value="{!m.id}" />
<apex:column headervalue="FirstName" value="{!m.FirstName}" />
<apex:column headervalue="LastName" value="{!m.LastName}" />
<apex:column headervalue="Email" value="{!m.Email}" />
</apex:dataTable>
</apex:page>

============Apex Cont=======

public class DatatableDemo {

public List<Contact> Con{get;set;}
public DatatableDemo()
{
Con=new List<Contact>();
con=[select id,FirstName,LastName,Email from Contact Limit 20];

}
}

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

Ripsaw777Ripsaw777

Thanks for the responses. The issue is that the way the object model is setup for this, its a bunch of static data in a table for a pseudo-questionaire. There are not multiple rows, thus pulling in a list is not viable. I basically need to plug in individual static fields that are setup with questions. Maybe this will help a bit

 

-Ian

Ripsaw777Ripsaw777

Also if you look at the pic in the link I posted originally there arent more rows that are being created, but the columns appear to be getting extended which is obviously not the intended result.

 

-Ian