To format a DataGrid column, we should set the formatter property which is a function. The format function contains two parameters:
- value: The current column value responding to field.
- record: The current row record data.
value-->对应字段的当前列值
record-->当前行记录数据
columns:[[
{field:'name',title:'广告系列',115,align:'center',
formatter:function(val,rec){
return '<a href="listByCamIdadGroupInfo.jspx?campaignId='+rec.googleCampaignId+'">'+val+'</a>';
}
},
直接使用rec.*便可拿到所要的值..................