grid中实现attachmentSimple上传图片需要在onCellRender中实现,具体实现如下:
Model.prototype.grid1CellRender = function(event){ if(event.colName == 'fFJ'){ //解析数据库中存储的json数据 var jsonList = eval("(" + event.colVal + ")"); var ownerID = event.rowID; if (jsonList != undefined) { var realFileName = encodeURIComponent(jsonList[0]["realFileName"]); var storeFileName = jsonList[0]["storeFileName"]; var operateType = "browse"; //根据上述解析出的信息获得路径 var url = '$UI/system/service/doc/common/simpleFileStore.j?realFileName=' + realFileName + '&storeFileName=' + storeFileName + '&ownerID=' + ownerID + '&operateType=' + operateType; url = require.toUrl(url); //把获取的路径给img显示 event.html = "<img src="+url+" xid='image1' style='height:70px;width:70px;'></img>" } } };
评一波