在我的Web应用程序中,我们使用此html标签data-section ='admin',因为它不会在网站的公共端显示控件。我以为我可以在模板列中使用它,所以它不会显示remove列。还有另一种方法可以在模板列中使用此数据部分吗?
if (!kendoGrid) {
$("#kgridPresentation").kendoGrid({
scrollable: false,
toolbar: ["search"],
columns: [
{
template: function (dataItem) {
return "<div align='center' data-section='admin'><a data-section='admin'><span data-section='admin' class='btn btn-red btn-custom' onclick=\"deletePresentation(" + dataItem.MeetingPresentationId + ", 'false')\"> <i class='fa fa-times'></i></span></a></div>";
},
title: "Remove",
width: "73px"
},
{
field: "PresentationTitle",
title: "Presentation Title"
},
{
template: function (dataItem) {
return "<a href=/Shared/Download.ashx?FileManagerId=" + dataItem.FileManager.FileManagerId + ">" + dataItem.FileManager.FileName + "</a>";
},
field: "FileManager.FileName",
title: "File Name"
},
{
field: "PresentationAuthor",
title: "Presentation Speaker"
}
],
noRecords: {
template: "No Result Found."
},
});
}
我要做的是一个返回带有布尔参数isAdminSection的列列表的函数。
有很多方法视觉上隐藏某些列,例如columns.hidden,宽度0等,但是具有CSS和开发人员基础知识的访问者可以轻松地对其进行修改并访问管理员的选项。这对于您来说是可以接受的,例如,如果删除演示文稿的功能始终在后端正确验证,并且只会对该用户返回HTTP 403错误。但是最好不要首先显示该列。