【问题标题】:Sharepoint 2013 JSLink TaskList custom item rendering with out of the box optionsSharepoint 2013 JSLink TaskList 自定义项目渲染,带有开箱即用选项
【发布时间】:2013-04-04 14:39:19
【问题描述】:

我无法找到使用 JSLink 自定义 SP2013 任务列表项呈现的方法,以完全改变列表项的呈现方式,但同时保留默认提供的所有开箱即用功能。

我的意思是,我想将列表元素显示为彩色框,同时保留排序选项、“...”(打开菜单)图标等。

我怎样才能实现它?是否有任何文档可以找到所有内部字段(如 PercentComplete 等)的列表,可以覆盖哪些渲染?

任何代码 sn-ps 将不胜感激!

非常感谢!

【问题讨论】:

    标签: sharepoint sharepoint-2013 tasklist


    【解决方案1】:

    看看here

    简而言之,您要做的是,在覆盖上下文对象中的Templates 对象上添加一个名为Fields 的对象。在此对象中,与列(字段)的静态名称相同的属性用于使用“视图”属性呈现值。因此,链接中的示例是:

    var overrideCtx = {};
    overrideCtx.Templates = {};
    // Override field data
    overrideCtx.Templates.Fields = {
        // PercentComplate = internal name of the % Complete
        // View = you want to change the field rendering of a view
        // <div ... = here we define what the output of the field will be.
        'PercentComplete': { 'View' : '<div style="background: #F3F3F3; display:block; height: 20px; width: 100px;"><div style="background: #0072C6; height: 100%; width: <#=ctx.CurrentItem.PercentComplete.replace(" %", "")#>%;"></div></div>' }
    };
    // Register the override of the field
    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx
    

    使用此方法,您将在其他字段中保留默认功能。只需确保该列在当前视图中可见即可。

    【讨论】:

      猜你喜欢
      • 2012-11-18
      • 1970-01-01
      • 2014-01-19
      • 2015-07-10
      • 1970-01-01
      • 1970-01-01
      • 2015-11-04
      • 1970-01-01
      • 2015-01-07
      相关资源
      最近更新 更多