2013-04-04 61 views
0

我無法找到自定義SP2013任務列表項目與JSLink渲染的方式,以便徹底改變列表項目的渲染方式但也保持全部默認提供的框功能。Sharepoint 2013 JSLink TaskList自定義項目渲染與開箱即用選項

我的意思是,我想顯示的列表元素顏色框,但也保持排序選項,「...」(打開菜單)圖標等

我怎樣才能實現呢?是否有任何文檔可以找到像PercentComplete等所有內部字段的列表,哪些渲染可以被覆蓋?

任何代碼片斷將非常感激!

非常感謝!

回答

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 

使用此方法,您將在其他字段中保留默認功能。只要確保該列在當前視圖中可見即可。