如何在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];
        }}}

我的Visuaforce页面代码

<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 (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...