+ Start a Discussion
Vijay Kumar Rebbala 1Vijay Kumar Rebbala 1 

How to display values in 4*7 format

//VFP:
<apex:page controller="Accountlistctrl">
    <apex:dataTable value="{!acctlist}" var="accs" columns="7" rows="{!rowcount}">
        <apex:outputField value="{!accs.Id}"/>
    </apex:dataTable>
</apex:page>

//CTRL:

public class Accountlistctrl {

public list<Account> acctlist {get;set;}
public Integer rowcount {get;set;}

    public Accountlistctrl(){
        acctlist = [SELECT Id, Name FROM Account Limit 19];
        integer s = acctlist.size();
        system.debug('***********list size*************'+s);
        rowcount = Integer.valueOf(Math.ceil(s/7));
        system.debug('***********rowcount*************'+rowcount);
    }
}
KevinPKevinP
Vijay, 

I'm sorry, there's not really enough of a question here for us to try and help you with. Are you wanting to display a grid of something?

You might look at using one of the bootstrap on salesforce css systems to do a grid of boxes if thats what your looking for?
Shashi PatowaryShashi Patowary
Thanks Kevin
@ Vijay - You can follow whatever Kevin has suggested.An simple way to implement grid in VF page is to use Apex:panelGrid -
e.g.
<apex:page >
    <apex:panelGrid columns="4" id="myGrid" rules="all">
        <apex:outputText value="First" id="theFirst"/>
        <apex:outputText value="Second" id="theSecond"/>
        <apex:outputText value="Third" id="theThird"/>
        <apex:outputText value="Fourth" id="theFourth"/>
        <apex:outputText value="Fifth" id="theFifth"/>
        <apex:outputText value="Sixth" id="theSixth"/>
        <apex:outputText value="Seventh" id="theSeventh"/>
        <apex:outputText value="Eighth" id="theEighth"/>
    </apex:panelGrid>
</apex:page>

This will result in

User-added image
You can change 'columns' or 'rules' according to your reuirement.This is a simple example only.

Please let me know if it helps.

Regards,
Shashi