{
field : "attachList",
title : "附件",
width : 250,
align : "center",
halign : "center",
fixed:true,
formatter : function(value,row,index){
// alert(row);
// alert(row.id);
return '<a href="#" onclick="dzglxx.main.download(\''+row.id+'\')" >'+value+'</a>';
}
}
alert(value)显示 undefined!。实体类中attachList对象跟field应该是对应的!
实体类
@ManyToMany(fetch = FetchType.LAZY, targetEntity = AttachmentEntity.class)
@JoinTable(name = "T_SYS_ATTACHMENT", joinColumns = { @JoinColumn(name = "entity_id") }, inverseJoinColumns = { @JoinColumn(name = "id") })
public List<AttachmentEntity> getAttachList() {
return attachList;
}
public void setAttachList(List<AttachmentEntity> attachList) {
this.attachList = attachList;
}
自己看客户端得到的内容,肯定是没有attachList属性才是undefined,你要得到类型下面的数据才对
{"rows":[{"attachList":"xxxxxxx"......},{"attachList":"xxxxxxx"......}...........]
你的datagrid匹配到你返回的字段为attachList的数据么?能匹配才有value,才能对其进行formatter
后台返回的字段肯定没有attachList属性,建议把返回的整条数据打印出来,对比一下