本文介绍了在CSR中显示文档库的默认标注-SharePoint 2016的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都使用CSR -SharePoint 2016 中的文档库的默认标注作为项目模板.

Have anybody used default callout of document library in CSR - SharePoint 2016 for Item template.

注意:SharePoint 2016的标注机制不同.

Note: callout mechanism for SharePoint 2016 is different.

注意:由于生成的HTML很复杂,因此必须使用项目模板-CSR .

Note: Item Template - CSR , is required to be used, because of complex html for generation.

var FolderViewContext = {};
FolderViewContext.Templates = {};

var FolderViewContext = {};
FolderViewContext.Templates = {}; 

FolderViewContext.Templates.Item = FolderViewTemplate;

FolderViewContext.Templates.Item = FolderViewTemplate;

--------------------------------------------------- -

-------------------------------------------------

一些研究:

http://blog.alexboev.com/2013/08/custom -callouts-in-sharepoint-2013.html

[不起作用,因为它基于SharePoint 2013,而不是2016.]

[ Does not work because, it is based on SharePoint 2013, not 2016.]

https://sharepoint .stackexchange.com/questions/97189/create-edit-control-block-ecb-on-view-with-jslink/97229#97229

[不起作用,因为此html已过期.在SharePoint 2016中]

[Does not work, because this html is out dated. in SharePoint 2016]

任何想法.

Cyber​​Bug

CyberBug

推荐答案

您可以引用SharePoint js库的调试版本并自行进行自定义.

例如:

您可以在INIT.debug.js中找到OOB CalloutRenderItemTemplate函数,因此可以自己替换现有的渲染逻辑部分. /span>

You could find OOB CalloutRenderItemTemplate function defined in INIT.debug.js, so you could replace existing render logic part by yourself.


示例代码:

 <script type="text/javascript">
        SP.SOD.executeFunc("callout.js", "Callout", function () {
            var itemCtx = {};
            itemCtx.Templates = {};
            itemCtx.BaseViewID = 'Callout';
            // Define the list template type
            itemCtx.ListTemplateType = 101;
            itemCtx.Templates.Item = function (itemCtx) {               
                return CustomFunction(itemCtx);
            };;
            SPClientTemplates.TemplateManager.RegisterTemplateOverrides(itemCtx);
        });
        function CustomFunction(renderCtx) {
            var ret = [];

            if (renderCtx.ListSchema.IsDocLib) {
                ret.push(CalloutRenderFilePreview(renderCtx));
            }
            ret.push(CalloutRenderDlpNotificationPlaceholder(renderCtx));
            ret.push(CustomLastModifiedInfo(renderCtx));//CalloutRenderLastModifiedInfo
            ret.push(CalloutRenderSharingStatus(renderCtx));
            ret.push(CalloutRenderSourceUrl(renderCtx));
            return ret.join('');
        }
        function CustomLastModifiedInfo(renderCtx) {
            var ret = [];
            ret.push(CalloutRenderLastModifiedInfo(renderCtx));
            var newSectionHtml = 'This is the content of the new callout section.';
            ret.push(newSectionHtml)
            var finalMarkup = ret.join('');

            return Callout.GenerateDefaultSection(null, finalMarkup);            
        }
    </script>



最好的问候,

Lee


这篇关于在CSR中显示文档库的默认标注-SharePoint 2016的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 07:50