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
OlbrestOlbrest 

How to list records in table ?

Hello.

Can you help me ?

I have a table of Clients. How I can display the list of records on apex page using javascript code ?

I wrote some of apex code, may be we can use it ?

Thank you.

Code:
    <apex:pageblocktable value="{!clients}" var="gift" id="theTable" width="80%">
        <apex:column >
                <apex:facet name="header">Client</apex:facet>
                <apex:outputText value="{!clients.name}"/>
        </apex:column>
        <apex:column >
                <apex:facet name="header">Age</apex:facet>
                <apex:outputText value="{!clients.age}"/>
        </apex:column>
        <apex:column >
                <apex:facet name="header">Status</apex:facet>
                <apex:outputText value="{!clients.status}"/>
        </apex:column>

    </apex:pageblocktable> 

 



ZY: Sorry for my poor English.


Message Edited by Olbrest on 12-30-2008 06:58 AM
OlbrestOlbrest
I find something, but my application still not work.

I got a error - List has more than 1 row for assignment to SObject

If I change query "select Firstname, Lastname from Contact"  to "select Firstname, Lastname from Contact limit 1" - application works and display one record.

I need a reson.

Thank you.


Code:
<apex:page controller="mySecondController">
<apex:dataTable value="{!contact}" var="vms" cellPadding="4" border="0">
<apex:column >
{!vms.FirstName}
</apex:column>
<apex:column >
{!vms.LastName}
</apex:column>
</apex:dataTable>
</apex:page>

 
Code:
public class mySecondController {

public Contact getContact() {
return [select Firstname, Lastname from Contact limit 1];
}

public String getName() {
return 'My Second Custom Controller';
}
}

 



Message Edited by Olbrest on 12-30-2008 09:42 AM
OlbrestOlbrest
I undestood my mistake.

Need to be

Code:
public Contact[] getContact()