javascript - 下载、打开和删除文件按钮不可见
问题描述
我正在尝试在 Asp.Net 和 Javascript 中修复一个网页,该网页允许用户上传文件,然后让他有机会下载或打开附件。
在 cshtml 文件中有一个 Javascript 函数,其结构如下:
DT.load("appointment-course-files").then(c => {
c.buildDom = function (table, wrapper) {
let titleBlock = document.createElement("div");
titleBlock.classList.add("clearfix", "m-b-1");
let title = document.createElement("h5");
title.classList.add("pull-xs-left");
title.textContent = "Files";
titleBlock.appendChild(title);
let clearfix = document.createElement("clearfix");
clearfix.classList.add("clearfix");
clearfix.appendChild(table);
wrapper.element.appendChild(titleBlock);
wrapper.element.appendChild(clearfix);
};
c.actions.add()
.style(ActionStyle.btn("black btn-round", "fas fa-search", "Apri"))
.open("/api/appointmentcourse/{AppCourseId}/files/{Id}?open=true");
c.actions.add()
.style(ActionStyle.btn("info btn-round", "fas fa-cloud-download-alt", "Download"))
.redirect("/api/appointmentcourse/{AppCourseId}/files/{Id}?open=false");
c.actions.add()
.style(ActionStyle.btn("danger btn-round", "fas fa-trash", "Elimina"))
.withConfirmation("Si sicuro di voler eliminare il file '{Filename}'?")
.ajax("DELETE", "/api/appointmentcourse/{AppCourseId}/files/{Id}");
});
相反,这是连接到 Javascript 的 DataTable 类:
public void BuildTables(IDataTableShelf shelf)
{
var u = SafePlusModels.Models.User.Empty;
var builder =
shelf.DefineTable<DTCourseAppointmentFile, AppointmentCourseFile>("appointment-course-files")
.SetPk(action => action.Id)
.AddColumn(action => action.Id).Hide().Done(AppointmentCourseFile.Empty.Id)
.AddColumn(action => action.Filename).SetTitle("Name").Done(AppointmentCourseFile.Empty.FileName)
.AddColumn(action => action.Uploader)
.SetTitle("Uploader").Done(u.Username)
.AddColumn(action => action.TimeStamp).SetTitle("Date").Done(AppointmentCourseFile.Empty.TimeStamp)
.AddColumn(action => action.AppCourseId).Hide().Done(AppointmentCourseFile.Empty.AppointmentCourse);
builder.Configuration.Columns.Write(cols =>
{
cols[nameof(Filename)].Configuration.LikeConditionScope = LikeConditionScope.Around;
});
builder.References
.Add(SafePlusModels.Models.User.GetTable(), new WhereStatementBuilder
{
{AppointmentCourseFile.Empty.Uploader, Operator.Equals, u.Id}
});
}
我用一系列断点调试了代码,但我看不出问题出在哪里。这对我来说似乎是正确的,但在某种程度上我不知道我看不到下载、打开和删除附加文档的按钮。有什么建议么?
解决方案
推荐阅读
- sql - SQL Server 查询中的 Like 语句不返回所有结果
- php - 流明苹果登录
- gfortran - 如何在 ubuntu 20.04 上安装 libgfortran.so.3
- excel - 如何在vba中复制单元格的格式?
- spring - Spring批处理作业启动具有递增参数的相同作业
- python - 五位数 N 拼图
- java - 如何计算android中输入的数据量
- javascript - 使用内置`crypto`的nodejs中的密码散列
- c# - 如何使用 SQL 查询更新子表
- azure-active-directory - 从 Azure AD 在 Claims 中获取职位、部门和经理 ID