【问题标题】:Viewing file properties instead of file in SharePoint document library在 SharePoint 文档库中查看文件属性而不是文件
【发布时间】:2018-12-10 07:11:48
【问题描述】:

我在 SharePoint Online 上有一个文档库,其中包含许多用于元数据的列。这些列不适合屏幕上的单个视图,因此我希望用户在下载文件之前先查看文件的属性。

有没有办法改变 SharePoint 库的行为,确保用户在单击文件名时首先查看文件属性?

PS:我知道我可以使用列表,但是在加载了大约 10000 个文档后,我决定将它作为最后的手段。谢谢。

【问题讨论】:

    标签: sharepoint libraries document


    【解决方案1】:

    通过CSR自定义链接文件名字段。

    示例代码:

    (function () {
        'use strict';
    
        var CustomWidthCtx = {};
    
        /**
         * Initialization
         */
        function init() {
    
            CustomWidthCtx.Templates = {};
    
            CustomWidthCtx.Templates.Fields = {            
                'LinkFilename': {
                    'View': customDisplay
                }
            };
    
            // Register the custom template
            SPClientTemplates.TemplateManager.RegisterTemplateOverrides(CustomWidthCtx);
        }
    
        /**
         * Rendering template
         */
        function customDisplay(ctx) {
            var currentVal = '';
            //from the context get the current item and it's value 
            if (ctx != null && ctx.CurrentItem != null)
                currentVal = ctx.CurrentItem[ctx.CurrentFieldSchema.Name];
    
            var el = "<div class='ms-vb  itx' id='" + ctx.CurrentItem.ID + "' app='' ctxname='ctx37'><a title='" + ctx.CurrentItem._ShortcutUrl + "' class='ms-listlink ms-draggable' aria-label='Shortcut file' onfocus='OnLink(this)' href='/Doc4/Forms/EditForm.aspx?ID=" + ctx.CurrentItem.ID + "' target='_blank' DragId='17'>" + ctx.CurrentItem.FileLeafRef + "</a></div>";
    
            // Render the HTML5 file input in place of the OOTB
            return el;
        }
    
        // Run our intiialization
        init();
    
    })();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-10-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-16
      相关资源
      最近更新 更多