如何解决如何在Visualforce页面中删除重复的单元格项目
我有一个控制器和visualforce页面,以显示3列(对象,TotalAttachmnentCount,ContentTypecount),其中对于每个ContentTypecount重复TotalAttachmnentCount值。我想在TotalAttachmnentCount中隐藏重复项,并为每个对象仅显示一次。
我的控制器代码
public Map<String,integer> mapofObject {set;get;}
public MyController(){
mapofObject = new Map<String,integer>();
for(AggregateResult at:[select Parent.Type b,count(id) from Attachment group BY Parent.Type]){
String Name = (string)(at.get('b'));
integer a = (integer)at.get('expr0');
mapofObject.put(Name,a);
}
}
public AggregateResult[] results {
get {
return [select Parent.Type b,Count(id) c,ContentType type from Attachment group By Parent.Type,ContentType];
}}}
<table border="1">
<th>Object</th>
<th>Total Attachments</th>
<th>ContentType count</th>
<apex:repeat value="{!results}" var="r">
<tr></tr>
<td> {!r['b']}</td>
<td>{!mapofObject[r['b']]}</td>
<td> {!r['c']}</td>
</apex:repeat>
</table>
注意:{!results}从上述控制器功能馈送到表中
我的输出
Object Total Attachments ContentTypecount
Contact 4 1
Contact 4 2
Contact 4 1
Opportunity 4 2
Opportunity 4 1
Opportunity 4 1
Account 3 2
Account 3 1
预期产量
Object TotalAttachments ContentTypecount
Contact 4 1
Contact 2
Contact 1
Opportunity 4 2
Opportunity 1
Opportunity 1
Account 3 2
Account 1
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。