【发布时间】:2015-09-09 14:51:58
【问题描述】:
有谁知道如何删除从 Kendo UI 网格导出到 PDF 和 Excel 功能生成的文件中的超链接?
我已经使用 CSS 自定义了相当数量的导出并删除了分页栏等。
但是我不知道如何阻止列标题成为超链接。
我试过设置
pointer-events: none;
cursor: default;
但这并没有帮助,我尽量避免使用 javascript 来删除它。
更新 请在下面查看我的网格代码的编辑版本。
@(Html.Kendo().Grid<MvcProject.Domain.DTO.Reports.AccidentSummary>()
.Name("resultsGrid")
.Columns(columns =>
{
columns.Group(group => group
.Title("Accident Summary Report : Date run - " + DateTime.Now.ToShortDateString() )
.Columns(header => {
header.Bound(c => c.DocCount)
.HtmlAttributes(new { style = "text-align: center;" })
.Title(" ")
.ClientTemplate("<div><i rel='tooltip' title='Documents Attached' #= DocCount > 0 ? classHasFile : '' #></i></div>")
.Width(35).Filterable(false).Sortable(false).Groupable(false).IncludeInMenu(false);
header.Bound(c => c.RegionName)
.Title("Region")
.Width(100);
header.Bound(c => c.AreaName)
.Title("Area")
.Width(200);
header.Bound(c => c.Date_of_Accident)
.Title("Date")
.Width(120)
.Format("{0:dd/MM/yyyy}");
header.Bound(c => c.Days_Lost)
.Title("Days Lost")
.HtmlAttributes(new { style = "text-align: center;" })
.Width(120);
header.Bound(c => c.TypeOfAccidentName)
.Title("Nature ")
.Width(150);
header.Bound(c => c.Location_of_Accident)
.Title("Location Of Accident")
.Width(150).Hidden(true);
header.Bound(c => c.Comments)
.Title("Comments")
.Width(250).Hidden(true);
})
);
})
.HtmlAttributes(new { style = "height: 900px;" })
.Pageable(p => p
.ButtonCount(5)
.PageSizes(true)
.Refresh(true)
)
.Scrollable(s => s.Height("auto"))
.Sortable()
.Filterable()
.Groupable()
.ColumnMenu()
.Resizable(r => r
.Columns(true)
)
.Excel(excel => excel
.FileName("Accident Summary.xlsx")
.Filterable(true)
.ProxyURL(Url.Action("_GridExportSave", "Reports"))
.AllPages(true)
)
.DataSource(d => d
.Ajax()
.Read(read => read.Action("_AccidentSummaryResults_Read", "Reports").Data("Genesis.Reports.HandS.Search.getPaginationData"))
.ServerOperation(true)
.PageSize(20)
)
.ToolBar(tools =>
{
tools.Pdf();
tools.Excel();
})
//PDF removed for now until it is patched
.Pdf(pdf => pdf
.AllPages()
.FileName("AccidentSummary.pdf")
.ProxyURL(Url.Action("_GridExportSave", "Reports"))
)
.Events(events => events.DataBound("Genesis.Reports.HandS.Search.loadTT"))
)
【问题讨论】:
-
启用了哪些网格功能(排序、分页等)?您使用什么来导出 PDF、内置网格功能或绘图 API?您使用的是哪个版本的剑道 UI?
-
请发布您的代码。你到底想达到什么目的?您仍然希望导出显示/工作或删除它吗?
-
@EdCharbeneau 请看上面我刚刚添加的代码。我们正在使用内置的 PDF 导出和版本 2015.2.902
-
@rohitreddyk 我希望标题仍显示在列上,只是不希望它们链接到 PDF 之外。
-
@GazWinter 找到任何解决方案?
标签: kendo-ui kendo-grid export-to-excel kendo-asp.net-mvc export-to-pdf