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

推荐订阅源

H
Hackread – Cybersecurity News, Data Breaches, AI and More
G
Google Developers Blog
The GitHub Blog
The GitHub Blog
Jina AI
Jina AI
A
About on SuperTechFans
MongoDB | Blog
MongoDB | Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园_首页
Blog — PlanetScale
Blog — PlanetScale
酷 壳 – CoolShell
酷 壳 – CoolShell
Google DeepMind News
Google DeepMind News
D
DataBreaches.Net
B
Blog RSS Feed
大猫的无限游戏
大猫的无限游戏
美团技术团队
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
L
LangChain Blog
WordPress大学
WordPress大学
S
SegmentFault 最新的问题
腾讯CDC
Hugging Face - Blog
Hugging Face - Blog
阮一峰的网络日志
阮一峰的网络日志
H
Help Net Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

博客园 - 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字段表头 自定义母版页之列表过滤菜单位置issue fix ListDefinition Tips QuickFlow UI 控件之 NamedFormAttachment SharePoint 2010 GridView/SPGridView完全应用系统样式 QuickFlow-如何通过QFD and ExecuteCode获取其他列表数据 DLL嵌入exe中
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>