惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Attack and Defense Labs
Attack and Defense Labs
The GitHub Blog
The GitHub Blog
C
Check Point Blog
博客园_首页
MongoDB | Blog
MongoDB | Blog
N
Netflix TechBlog - Medium
F
Full Disclosure
Microsoft Security Blog
Microsoft Security Blog
爱范儿
爱范儿
Recent Announcements
Recent Announcements
阮一峰的网络日志
阮一峰的网络日志
G
GRAHAM CLULEY
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Threat Research - Cisco Blogs
C
Cybersecurity and Infrastructure Security Agency CISA
V
Vulnerabilities – Threatpost
K
Kaspersky official blog
博客园 - 司徒正美
S
Schneier on Security
T
The Exploit Database - CXSecurity.com
Project Zero
Project Zero
云风的 BLOG
云风的 BLOG
Cisco Talos Blog
Cisco Talos Blog
Know Your Adversary
Know Your Adversary
雷峰网
雷峰网
V
V2EX - 技术
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Spread Privacy
Spread Privacy
罗磊的独立博客
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security Affairs
SecWiki News
SecWiki News
Schneier on Security
Schneier on Security
O
OpenAI News
Jina AI
Jina AI
PCI Perspectives
PCI Perspectives
Cyberwarzone
Cyberwarzone
Y
Y Combinator Blog
Apple Machine Learning Research
Apple Machine Learning Research
B
Blog RSS Feed
I
InfoQ
D
Docker
P
Palo Alto Networks Blog
Recorded Future
Recorded Future
M
MIT News - Artificial intelligence
博客园 - Franky
B
Blog
Scott Helme
Scott Helme
博客园 - 叶小钗
D
DataBreaches.Net

博客园 - jianyi

SpringBoot - open-in-view 机制分析 w3wp CPU 100%问题解决 ShrePoint 迁移域控 SharePoint online 获取文件版本记录 VS2015 ionic 开发环境配置纪要 TFS online build change web.config SharePoint 2016 - 安装QuickFlow2013 EF Migrations error: No connection string named 'MpDb' could be found in the application config file. TFS online 自动部署配置 SharePoint Permission Extension SharePoint暂时禁用事件触发 视图xsl定制之嵌入服务器控件 自定义View字段表头 - jianyi 自定义母版页之列表过滤菜单位置issue fix ListDefinition Tips - jianyi QuickFlow UI 控件之 NamedFormAttachment - jianyi SharePoint 2010 GridView/SPGridView完全应用系统样式 QuickFlow-如何通过QFD and ExecuteCode获取其他列表数据 - jianyi DLL嵌入exe中 - jianyi
SharePonit online 列表表单定制
jianyi · 2017-11-20 · via 博客园 - jianyi

1)在O365管理中心,确保启用了站点脚本定制,否则,网站不允许将页面切换到编辑模式。

2)Ribbon上,列表-》表单web部件-》编辑窗体

如果没有Ribbon,则到列表高级设置,启用经典UI

3)编辑表单webpart,设置其表单模板名称为CSRListForm, 默认的ListForm,只能支持定制某个字段,不支持定制整个Layout

4)增加脚本编辑器Web部件,里面写脚本,很多文章都讲了CSR机制.

ref:https://code.msdn.microsoft.com/office/CSR-code-samples-11-Fully-54ebcaa6

<script>


// List Forms – User CSRListForm Server Tempalte 
// Muawiyah Shannak , @MuShannak  
  
(function () {  
  
    // Create object that have the context information about the field that we want to change it's output render   
    var formTemplate = {}; 
    formTemplate.Templates = {}; 
    formTemplate.Templates.Item= viewTemplate; 
  
    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(formTemplate); 
  
})();  
  
// This function provides the rendering logic for the Custom Form 
function viewTemplate(ctx) { 
     
    var formTable = "".concat("<table width='100%' cellpadding='5'>", 
                                    "<tr>", 
                                        "<td><div>Title</div></td>", 
                                        "<td><div>{{TitleCtrl}}</div></td>", 
                                        "<td><div>CompanyCtrl</div></td>", 
                                        "<td><div>{{CompanyCtrl}}</div></td>", 
                                    "</tr>", 
                                    "<tr>", 
                                        "<td><div>Category</div></td>", 
                                            "<td><div>{{CategoryCtrl}}</div></td>", 
                                        "<td><div>Active</div></td>", 
                                        "<td><div>{{ActiveCtrl}}</div></td>", 
                                    "</tr>", 
                                    "<tr>", 
                                        "<td></td>", 
                                        "<td><input type='button' value='Save' onclick=\"SPClientForms.ClientFormManager.SubmitClientForm('{{FormId}}')\" style='margin-left:0' ></td>", 
                                    "</tr>", 
                              "</table>"); 
 
     
    //Replace the tokens with the default sharepoint controls 
    formTable = formTable.replace("{{TitleCtrl}}", getSPFieldRender(ctx, "Title")); 
  formTable = formTable.replace("{{CompanyCtrl}}", getSPFieldRender(ctx, "Company")); 
  //  formTable = formTable.replace("{{CategoryCtrl}}", getSPFieldRender(ctx, "Category")); 
   // formTable = formTable.replace("{{ActiveCtrl}}", getSPFieldRender(ctx, "Active")); 
    formTable = formTable.replace("{{FormId}}", ctx.FormUniqueId); 
 
    return formTable; 
} 
 
//This function code set the required properties and call the OOTB (default) function that use to render Sharepoint Fields  
function getSPFieldRender(ctx, fieldName) 
{ 
    var fieldContext = ctx; 
 
    //Get the filed Schema 
    var result = ctx.ListSchema.Field.filter(function( obj ) { 
        return obj.Name == fieldName; 
    }); 
 
    //Set the field Schema  & default value 
    fieldContext.CurrentFieldSchema = result[0]; 
    fieldContext.CurrentFieldValue = ctx.ListData.Items[0][fieldName]; 

if(ctx.Templates.Fields[fieldName]==null)
return "";
 
    //Call  OOTB field render function  
    return ctx.Templates.Fields[fieldName](fieldContext); 
} 

</script>