You need to sign in to do that
Don't have an account?

Display a List on a table in visualforce
Hi,
I need fill some columns with the value of the same field, but until now I can't make this work. So I wondering if I can use a variable of type list to get all the informations that I need and display in a table that each value will be separated by <tr><td>VALUE[0]</td></tr>
is it possible?
Best Regards
Rafael
I need fill some columns with the value of the same field, but until now I can't make this work. So I wondering if I can use a variable of type list to get all the informations that I need and display in a table that each value will be separated by <tr><td>VALUE[0]</td></tr>
is it possible?
Best Regards
Rafael
I do not have any code, i am just giving solution. For more info please visit link : https://developer.salesforce.com/page/Wrapper_Class
Yes I will share the code with you.
First I will explain what I need.
Object Account - Account
Object Produto_da_Mancha__c - Suporte, ADM, BS/BH, ServiceNow
Each Product have a field Called Status__c, and each product is a Register (The registers are generated automatically by trigger).
Here is my Code
VisualForce:
<apex:page showHeader="false" sidebar="false" standardStylesheets="false"
applyHtmlTag="false" applyBodyTag="false" docType="html-5.0" controller="Account_Mancha">
<html>
<head>
<title>Mancha</title>
</head>
<body>
<header>
<div class="bar_container">
<ul>
<li>
<a href="">Oportunidade</a>
</li>
<li>
<a href="">Contas</a>
</li>
<li>
<a href="">Contatos</a>
</li>
</ul>
</div>
</header>
<div class="painel">
<h1>MANCHA</h1>
<table>
<tr>
<th colspan="1" class="celula_em_branco"></th>
<th colspan="4" class="celula_azul_escuro">MANAGED SERVICES</th>
</tr>
<tr>
<td class="cor_cinza td_column">Account</td>
<td class="cor_cinza td_column">Suporte</td>
<td class="cor_cinza td_column">Adm</td>
<td class="cor_cinza td_column">BS/BH</td>
<td class="cor_cinza td_column">ServiceNow</td>
</tr>
<apex:repeat value="{!TodasContas}" var="conta">
<tr>
<td class="celula_azul_escuro">{!conta.Name}</td>
<apex:repeat value="{!conta.Produtos_da_Mancha__r}" var="produtos">
<td class="cor_azul">{!produtos.Status__c}</td>
<td class="cor_verde">HERE MUST ADM STATUS}</td>
<td class="cor_amarelo">HERE MUST BS/BH STATUS</td>
<td class="cor_azul">HERE MUST BE SERVICENOW STATUS</td>
</apex:repeat>
</tr>
</apex:repeat>
</table>
</div>
<footer>
<div class="bar_container">
<ul>
<li>SERVICE IT</li>
</ul>
</div>
</footer>
</body>
</html>
</apex:page>
APEX:
public class Account_Mancha {
public Account_Mancha(){
}
public List<Account> getTodasContas(){
List<Account> accounts = [SELECT Account.Id, Account.Name, (SELECT Produto_da_Mancha__c.Name, Produto_da_Mancha__c.Conta_Id__c, Produto_da_Mancha__c.Status__c FROM Produtos_da_Mancha__r WHERE Produto_da_Mancha__c.Conta_Id__c != null AND Produto_da_Mancha__c.Name = 'Suporte') FROM Account];
return accounts;
}
}
Best Regards
Rafael
Any help about this issue?
Create a wrapper class as below
Class accoutProdWrapper{
String AccountName;
Map<String, String> Product2Status; //hold key value pair of product and their status
}
Create list of wrapper class i.e List<accountProdWrapper> and add records to it doing respective queries.
User this list on the VF page to display values in the table.
Hope this helps !