|  | 
 
| 第一步:easyui.tld 在easyui.tld中搜索<name>dgCol</name>,在结尾添加
 第二步:org.jeecgframework.tag.core.easyui.DataGridColumnTag复制代码                <attribute>
                        <name>imageDiy</name>
                        <rtexprvalue>true</rtexprvalue>
                        <description>自定义图片大小字段(格式:width,height)</description>
                </attribute>
                <attribute>
                        <name>download</name>
                        <rtexprvalue>true</rtexprvalue>
                        <description>附件下载(true,false)</description>
                </attribute>
在org.jeecgframework.tag.core.easyui.DataGridColumnTag中添加
 在结尾doEndTag()方法的parent.setColumn中结尾添加  ,imageDiy,download复制代码protected String imageDiy;
protected boolean download;
public void setDownload(boolean download) {
        this.download = download;
}
public void setImageDiy(String imageDiy) {
        this.imageDiy = imageDiy;
}
 第三步:org.jeecgframework.tag.core.easyui.DataGridTag
 在org.jeecgframework.tag.core.easyui.DataGridTag的setColumn方法中添加 , String imageDiy,boolean download(和之前doEndTag()中的位置不能变)
 下面再添加dateGridColumn.setImageDiy(imageDiy);和dateGridColumn.setDownload(download);
 最后在getField(StringBuffer sb, int frozen)方法下if (column.isImage())下添加
 大功告成!复制代码                                // 自定义显示图片
                                if (column.getImageDiy() != null) {
                                        String[] tld = column.getImageDiy().split(",");
                                        sb.append(",formatter:function(value,rec,index){");
                                        sb.append(" return '<img width="" + tld[0]
                                                        + "" height="" + tld[1]
                                                        + "" border="0" src="'+value+'"/>'}");
                                        tld = null;
                                }
                                if (column.isDownload()) {
                                        sb.append(",formatter:function(value,rec,index){");
                                        sb.append(" return '<a target="_blank" href="'+value+'">点击下载</a>'}");
                                }
 
 
 
 
 
 | 
 |