• #16726
    Salesforce | PRANAV PRANAV #679
    Forcetalks

    In Salesforce, how to display dynamic table records in horizontal format?

    Hi All,

    How to display dynamic table records in horizontal format?

    Actually the table records are selected by checkboxes and those selected records are displayed in an another table in horizontal format with headings in a single column.

    Thanks

     

    #18038
    Salesforce | Vikas Kumar Vikas Kumar #319
    Forcetalks

    Hi pranav ,

    public class RowWrapper
    {
    // the values (cells) making up this row
    public List<String> values {get; set;}

    // constructor
    public RowWrapper()
    {
    values=new List<String>();
    }

    // append a value (cell) to the row
    public void addValue(String value)
    {
    values.add(value);
    }
    }

    public List<Account> getAccounts()
    {
    if (null==accs)
    {
    accs=[select id, Name, BillingStreet, BillingCity, BillingPostalCode from Account
    where BillingCity != null and BillingPostalCode!=null limit 3];
    }

    return accs;
    }

    // retrieves the list of row wrappers
    public List<RowWrapper> getRowWrappers()
    {
    if (null==rows)
    {
    rows=new List<RowWrapper>();

    // create a row for each field – there are 4 of these, Name, Street, City and PostCode
    for (Integer idx=0; idx<4; idx++)
    {
    rows.add(new RowWrapper());
    }

    // iterate the accounts and populate the rows
    for (Integer idx=0; idx<getAccounts().size(); idx++)
    {
    rows[0].addValue(getAccounts()[idx].Name);
    rows[1].addValue(getAccounts()[idx].BillingStreet);
    rows[2].addValue(getAccounts()[idx].BillingCity);
    rows[3].addValue(getAccounts()[idx].BillingPostalCode);
    }
    }

    return rows;
    }

    Vf Page

    <table class=”list” border=”0″ cellpadding=”0″ cellspacing=”0″>
    <tr class=”headerRow “>
    <apex:repeat value=”{!headWrap.values}” var=”heading”>
    <th class=”headerRow “>
    {!heading}
    </th>
    </apex:repeat>
    </tr>
    <apex:repeat value=”{!rowWrappers}” var=”row”>
    <tr>
    <apex:repeat value=”{!row.values}” var=”value”>
    <td>
    {!value}
    </td>
    </apex:repeat>
    </tr>
    </apex:repeat>
    </table>

    Go through This Blog

    http://bobbuzzard.blogspot.in/2010/09/rotating-visualforce-table.html

     

Viewing 2 posts - 1 through 2 (of 2 total)

Please to reply to this topic.

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2019 Forcetalks. All Right Reserved.

Log in with your credentials

or    

Forgot your details?