I think I have answered something like this before, but cannot find it – maybe it was answered by email.
What you need to do is to add something like this in your Custom JS:
setInterval(function(){
if(jQuery("#idAttachmentsTable tr").length > 0){
spjs.dffs.doReadOnly(["Attachments"]);
}else{
spjs.dffs.undoReadOnly(["Attachments"]);
}
},1000);
I haven’t tested it so it might need some tinkering, but you can try it out.
Alexander