1 背景:
新接手系统页面展示采用easyUI,因为业务调整新增字段,数据库存code,页面想转义展示对应汉字。
2.参照官网:http://www.jeasyui.net/tutorial/28.html
function formatPrice(val,row){
if (val < 20){
return '<span style="color:red;">('+val+')</span>';
} else {
return val;
}
}
格式化函数。可是该函数在th那种页面可以使用,在field后面不知道怎么加。
网上看了个例子:
$(document).ready(function() {
$('#dg').datagrid({
url : "/bboo/resource/gj-resource!queryResource.do",
columns : [ [ {
field : 'resourceId',
title : '菜单id',
width : 50,
sortable : true
}, {
field : 'description',
title : '描述',
width : 50,
sortable : true
}, {
field : 'name',
title : '名称',
width : 50,
sortable : true
}, {
field : 'sort',
title : '分类',
width : 50,
sortable : true
}, {
field : 'type',
title : '类型',
width : 50,
sortable : true
}, {
field : 'value',
title : 'url值',
width : 50,
sortable : true
}, {
field : 'pid',
title : '父菜单',
width : 80,
formatter : function(value, row, index) {
if (row.parent) {
return row.parent.resourceId;
} else {
return value;
}
}
} ] ]
});
});
放到别的位置极有可能提示错误。
**********参开文档如下********************
http://blog.csdn.net/u010523770/article/details/51838989