jquery EasyUI的formatter格式化
时间:2011-01-12 来源:archie2010
- value: 对应字段的当前列的值
- record: 当前行的记录数据
$('#tt').datagrid({
title:'Formatting Columns',
width:550,
">250,
url:'datagrid_data.json',
columns:[[
{field:'itemid',title:'Item ID',width:80},
{field:'productid',title:'Product ID',width:80},
{field:'listprice',title:'List Price',width:80,align:'right',
formatter:function(val,rec){
if (val < 20){
return '<span style="color:red;">('+val+')</span>';
} else {
return val;
}
}
},
{field:'unitcost',title:'Unit Cost',width:80,align:'right'},
{field:'attr1',title:'Attribute',width:100},
{field:'status',title:'Status',width:60}
]]
});
相关阅读 更多 +