码迷,mamicode.com
首页 > 其他好文 > 详细

jeecg3.5中为dgCol标签增加自定义格式化列中的数值的功能

时间:2015-04-22 16:28:13      阅读:1896      评论:0      收藏:0      [点我收藏+]

标签:

jeecg3.5中只有formatter属性,只支持格式化时间格式的数据,不支持自定义格式化列中的值的功能,比如想把列中的的一个int或long型的值除以100转成float或doulbe值,jeecg3.5版本就不支持类似customFormatter这样属性,本文为jeecg3.5增加这个功能,主要修改的代码如下:

org.jeecgframework.tag.core.easyui.DataGridColumnTag

//51行 
private String customFormatter;
//190-192行
public void setCustomFormatter(String customFormatter) {
		this.customFormatter = customFormatter;
	}
//58行
parent.setColumn(title,field,width,rowspan,colspan,align,sortable,checkbox,formatter,hidden,replace,treefield,image,imageSize,query,url,funname,arg,queryMode, dictionary,frozenColumn,extend,style,downloadName,autocomplete,extendParams, customFormatter);

org.jeecgframework.tag.core.easyui.DataGridTag

//257行
String style,String downloadName,boolean isAuto,String extendParams, String customFormater) {
//285行
dataGridColumn.setCustomFormater(customFormater);
//1082-1087行
//自定义格式化数据函数
			if (column.getCustomFormater() != null) {
				sb.append(",formatter:function(value,rec,index){");
				sb.append("return ").append(column.getCustomFormater()).append("(value, rec, index);");
				sb.append("}");
			}

org.jeecgframework.tag.vo.easyui.DataGridColumn

//39行
private String customFormater;//自定义格式化数据函数
//253-259行
public String getCustomFormater() {
		return customFormater;
	}

	public void setCustomFormater(String customFormater) {
		this.customFormater = customFormater;
	}

WEB-INF/tld/easyui.tld

<!-- 334-338行-->
<attribute>
			<name>customFormatter</name>
			<rtexprvalue>true</rtexprvalue>
			<description>自定义格式分数据函数</description>
		</attribute>


jeecg3.5中为dgCol标签增加自定义格式化列中的数值的功能

标签:

原文地址:http://my.oschina.net/u/914897/blog/405050

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!