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
anurajanuraj 

Custom Table

Hi,

Please tell me how to create a custom table with 10 columns. 

Thanks 

Anu

Best Answer chosen by Admin (Salesforce Developers) 
AshanAshan

<apex:reapeat> can be used when you have a List of object and want to craete a custom table from it

Ex:

<table>

<apex:repeat value="{!accounts}" var="item">

<tr>

<td>

<apex:outputField value="{!item.name}"/>

</td>

</tr>

</apex:repeat>

</table>

 Here accounts is a list of objects

All Answers

Balwant_SinghBalwant_Singh

you can use simply HTML or use <apex:repeat> tag.

anurajanuraj

Hi Balwant

   Can u tell me how to use it .

Thanks 

Anu

 

Balwant_SinghBalwant_Singh

In HTML you can use

<table>

<tr><td>your content</td></tr>

</table>

and in visualforce you can do it as

<apex:pageBlockTable value="{!wrapList}" var="aa">

<apex:column headerValue="ColumnHeaderName" value="{!aa.valueincustomobject_c}"  /> 

</apex:pageBlockTable>

 

where "{!wrapList}" is corresponding to list in controller class contains value of table which you want to print.

anurajanuraj

Hi 

No, I want to know how to use <apex:repeat>.

thanks

Anu

AshanAshan

<apex:reapeat> can be used when you have a List of object and want to craete a custom table from it

Ex:

<table>

<apex:repeat value="{!accounts}" var="item">

<tr>

<td>

<apex:outputField value="{!item.name}"/>

</td>

</tr>

</apex:repeat>

</table>

 Here accounts is a list of objects

This was selected as the best answer
aballardaballard

but why not use apex:datatable or apex:pageblocktable and apex:column to do the work?