Hi, well I’ve answered all my own questions. So, here is some sample code for displaying view/download/delete icons next to a “display” field in a dynamic form when there is a file attached. Notice the calls to datasource.viewFile and datasource.downloadFile which appear to be undocumented at this point for 6.5.1. Maybe someone else will find this useful and I think this is something that should eventually be built into the native smartclient product
//dipslay field that only shows if there is an attachedFile value
//for this record
{name:"attachedFileDisplay",colSpan:3,type:"staticText",prompt:"<spring:message code="desc.an.attachedfilename"/>",
shouldSaveValue:false,showIf:"return assetNotesRecord!=null && assetNotesRecord.attachedFile_filename!=null;",canEdit:false,
icons: [
{
src:"[SKIN]/actions/view.png",
click:"assetNotesEditor.dataSource.viewFile(assetNotesRecord);"
},
{
src:"[SKIN]/actions/download.png",
click:"assetNotesEditor.dataSource.downloadFile(assetNotesRecord);"
},
{
src: "[SKIN]/actions/cancel.png",
click: function(){
isc.confirm("<spring:message code="prompt.an.confirmremovefile"/>",
null,
// Apply properties to the dialog to handle save / cancel clicks--%>
{
buttons:[isc.Dialog.OK,
isc.Dialog.CANCEL
],
okClick : function () {
removeAttachedFile();
this.hide();
},
cancelClick : function () {
this.hide();
isc.clearPrompt();
}
}
);
}
}
]},
function removeAttachedFile(){
assetNotesEditor.getField("attachedFileDisplay").setValue(null);
if(assetNotesRecord!=null){
assetNotesRecord.attachedFile_filename=null;
}
assetNotesEditor.markForRedraw();
isc.Timer.setTimeout(
function(){
isc.say("<spring:message code="prompt.an.postremovefile"/>");
}
,0)
}
Also, here is a patch for displaying a blank cell in a list grid instead of view/download links when there is no attached file
//patch for displaying blank grid cell if no attached file
if (window.isc && isc.version.startsWith("6.5.1/")) {
isc.ListGrid.getPrototype().addProperties({
$30q:function(_1,_2,_3,_4,_5,_6){
if(isc.isA.String(_1))return _1;
var _7=_4[_2.name+"_filename"];
if(_7!=null){
var _8=isc.Canvas.imgHTML("[SKIN]actions/view.png",16,16,null,"style='cursor:"+isc.Canvas.HAND+"' onclick='"+_3.getID()+".viewRow("+_5+")'");
var _9=isc.Canvas.imgHTML("[SKIN]actions/download.png",16,16,null,"style='cursor:"+isc.Canvas.HAND+"' onclick='"+_3.getID()+".downloadRow("+_5+")'");
return _8+" "+_9+" "+_7
}else{
return null;
}
}
})
}