gpt4 book ai didi

javascript - Xpages多次上传删除附件

转载 作者:行者123 更新时间:2023-11-28 07:53:20 25 4
gpt4 key购买 nike

我已经下载了以下内容opennsf 。我想为每个上传的文档添加如果您选择错误则删除的选项。我设法在脚本中添加一个按钮,但我不知道如何将其链接到附件。

这是编辑后的代码:

var files = document.getElementById('ynFileUploadMulti').files;
var html = '';
if (files && files.length > 0) {
if(dojo.byId("ynFileUploadInfo").innerHTML == "" ) {
html = '<table id="ynFileUpload" class="xspDataTableFileDownload" style="width:100%;margin-bottom:1em">';
html += '<thead style="color:#545454;"><tr><th style="font-weight:bold;width:46px">Size</th><th style="font-weight:bold">Files to Upload</th><th style="font-weight:bold">Delete</th></tr></thead><tbody style="color:#a0a0a0">';
}
else{
html += dojo.byId("ynFileUploadInfo").innerHTML;
html = html.replace("</tbody></table>", "");
}
for (var i = 0; i < files.length; i++) {
var file = files[i];
var fileSize = 0;
if (file.size > 1024 * 1024)
fileSize = (Math.round(file.size / (1024 * 1024))).toString() + ' MB';
else
fileSize = (Math.round(file.size / 1024)).toString() + ' KB';
html += '<tr><td>'+fileSize+'</td><td>'+file.name+'</td><td ><button onclick="myFunction()">x</button></td></tr>'
}
html += '</tbody></table>';
}
dojo.byId("ynFileUploadInfo").innerHTML = html;
} catch (e) {
console.log("ynUpload_onchange: "+e);
}

此代码位于 ynUploader_onchange() 函数中。但我想我也需要接触其他函数(ynUploader_worker(.....)函数)?我怎样才能实现这个目标?

最佳答案

您可以使用文件下载控件中的“允许删除”属性,也可以使用以下代码在 xpage/cc 上放置一个按钮来获取上传文件的句柄

  var attList = document1.getAttachmentList("AttachmentRT");
for(var i=0; i<attList.size(); i++)
{
var att:String = attList[i];
// Here you can process every uploaded file
}

AttachmentRT 是绑定(bind)到文件下载的notesrichtext 字段的名称

关于javascript - Xpages多次上传删除附件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26483774/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com