SharePoint 联系人卡片列表视图格式不显示内容
SharePoint Contact Card List View formatting is not displaying content
我正在尝试通过定制 github 上可用的示例将列表视图格式化为名片格式。我设法让名片显示为灰色框,但无法让项目详细信息显示在框中。
尝试了很多不同的东西。更改了列名,仅包含 json 一列以确保正确。尝试作为 div 和跨度。列名中没有 space。列名中的空格。 % 列名中有 space 的地方。我得到的最好的是 object Object 或最后一个 child 作为 "a" elmtype 显示为超链接但没有其他字段。也不能在条目上方的卡片中显示列标题。
{
"$schema":"https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
"hideSelection":true,
"hideListHeader":true,
"rowFormatter":{
"elmType":"div",
"style":{
"float":"left",
"display":"flex",
"flex-wrap":"wrap",
"flex-direction":"column",
"align-items":"stretch",
"justify-content":"space-around",
"min-width":"600px",
"min-height":"486px",
"border-radius":"8px",
"margin-right":"10px",
"margin-bottom":"10px",
"box-shadow":"2px 2px 4px darkgrey"
},
"attributes":{
"class":"ms-bgColor-neutralLighterAlt ms-bgColor-neutralLight--hover ms-fontColor-themePrimary--hover"
},
"children":[
{
"elmType":"div",
"txtContent":"[$FirstName]",
"style":{
"color":"black",
"font-style":"normal",
"font-size":"10px",
"display":"block",
"width":"250px",
"height":"50px",
"border-radius":"50%",
"word-wrap":"initial",
"white-space":"nowrap",
"flex-grow":"1",
"flex-direction":"column",
"flex-wrap":"wrap"
}
}
]
}
}
以上示例只是我原始列表视图中的列标题之一。条目的名字未出现在框中
{
"$schema":"https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
"hideSelection":true,
"hideListHeader":true,
"rowFormatter":{
"elmType":"div",
"style":{
"float":"left",
"flex-wrap":"wrap",
"flex-direction":"row",
"width":"600px",
"height":"900px",
"border-radius":"8px",
"margin-right":"10px",
"margin-bottom":"10px",
"box-shadow":"2px 2px 4px darkgrey"
},
"attributes":{
"class":"ms-bgColor-neutralLighterAlt ms-bgColor-neutralLight--hover ms-fontColor-themePrimary--hover"
},
"children":[
{
"elmType":"div",
"__comment:":"DIV 1",
"style":{
"flex-grow":"1",
"display":"flex",
"flex-direction":"column",
"flex-wrap":"nowrap"
},
"children":[
{
"elmType":"div",
"txtContent":"=[$FullName]",
"style":{
"display":"block",
"font-size":"16px",
"font-weight":"bold",
"padding-top":"20px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"Job Title",
"style":{
"display":"block",
"font-size":"14px",
"font-weight":"bold",
"padding-top":"20px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"=[$JobTitle]",
"style":{
"display":"block",
"font-size":"12px",
"font-color":"red",
"font-weight":"normal",
"padding-top":"10px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"Career Interests",
"style":{
"display":"block",
"font-size":"14px",
"font-weight":"bold",
"padding-top":"20px",
"margin-left":"10px",
"margin-right":"10px",
"margin-top":"10px",
"margin-bottom":"10px"
}
},
{
"elmType":"div",
"txtContent":"=[$CareerInterests]",
"style":{
"display":"block",
"font-size":"12px",
"font-weight":"normal",
"padding-top":"10px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"Beginner",
"style":{
"display":"block",
"font-size":"14px",
"font-weight":"bold",
"padding-top":"20px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"=[$SkillLevelBeginner]",
"style":{
"display":"block",
"font-size":"12px",
"font-weight":"normal",
"padding-top":"10px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"Intermediate",
"style":{
"display":"block",
"font-size":"14px",
"font-weight":"bold",
"padding-top":"20px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"=[$SkillLevelIntermediate]",
"style":{
"display":"block",
"font-size":"12px",
"font-weight":"normal",
"padding-top":"10px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"Advanced",
"style":{
"display":"block",
"font-size":"14px",
"font-weight":"bold",
"padding-top":"20px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"=[$SkillLevelAdvanced]",
"style":{
"display":"block",
"font-size":"12px",
"font-weight":"normal",
"padding-top":"10px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"Previous Roles",
"style":{
"display":"block",
"font-size":"14px",
"font-weight":"bold",
"padding-top":"20px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"=[$PreviousRoles]",
"style":{
"display":"block",
"font-size":"12px",
"font-weight":"normal",
"padding-top":"10px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"Qualifications",
"style":{
"display":"block",
"font-size":"14px",
"font-weight":"bold",
"padding-top":"20px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"Primary Qualifications",
"style":{
"display":"block",
"font-size":"14px",
"font-weight":"bold",
"padding-top":"20px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"=[$PrimaryQualifications]",
"style":{
"display":"block",
"font-size":"12px",
"font-weight":"normal",
"padding-top":"10px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"=[$PrimaryDisciplineMajor]",
"style":{
"display":"block",
"font-size":"12px",
"font-weight":"normal",
"padding-top":"10px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"Additional Qualifications",
"style":{
"display":"block",
"font-size":"14px",
"font-weight":"bold",
"padding-top":"10px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"=[$AdditionalQualifications]",
"style":{
"display":"block",
"font-size":"12px",
"font-weight":"normal",
"padding-top":"10px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType": "a",
"style": {
"border": "none",
"padding-top": "15px",
"background-color": "transparent",
"color": "#0078d7",
"margin-left":"10px",
"margin-bottom": "20px",
"text-align": "left",
"cursor": "pointer",
"display": "=if([$LinkedIn]=='','none','')"
},
"attributes": {
"target": "_blank",
"iconName": "LinkedInLogo",
"href": "[$LinkedIn]"
}
},
{
"elmType": "a",
"style": {
"border": "none",
"display":"float",
"padding-top": "15px",
"background-color": "transparent",
"color": "#0078d7",
"margin-left":"10px",
"margin-bottom": "20px",
"text-align": "left",
"cursor": "pointer"
},
"attributes": {
"target": "_blank",
"iconName": "CreateMailRule",
"href": "[$FullName.email]",
"title": "Email"
}
}
]
}
]
}
}
我正在尝试通过定制 github 上可用的示例将列表视图格式化为名片格式。我设法让名片显示为灰色框,但无法让项目详细信息显示在框中。
尝试了很多不同的东西。更改了列名,仅包含 json 一列以确保正确。尝试作为 div 和跨度。列名中没有 space。列名中的空格。 % 列名中有 space 的地方。我得到的最好的是 object Object 或最后一个 child 作为 "a" elmtype 显示为超链接但没有其他字段。也不能在条目上方的卡片中显示列标题。
{
"$schema":"https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
"hideSelection":true,
"hideListHeader":true,
"rowFormatter":{
"elmType":"div",
"style":{
"float":"left",
"display":"flex",
"flex-wrap":"wrap",
"flex-direction":"column",
"align-items":"stretch",
"justify-content":"space-around",
"min-width":"600px",
"min-height":"486px",
"border-radius":"8px",
"margin-right":"10px",
"margin-bottom":"10px",
"box-shadow":"2px 2px 4px darkgrey"
},
"attributes":{
"class":"ms-bgColor-neutralLighterAlt ms-bgColor-neutralLight--hover ms-fontColor-themePrimary--hover"
},
"children":[
{
"elmType":"div",
"txtContent":"[$FirstName]",
"style":{
"color":"black",
"font-style":"normal",
"font-size":"10px",
"display":"block",
"width":"250px",
"height":"50px",
"border-radius":"50%",
"word-wrap":"initial",
"white-space":"nowrap",
"flex-grow":"1",
"flex-direction":"column",
"flex-wrap":"wrap"
}
}
]
}
}
以上示例只是我原始列表视图中的列标题之一。条目的名字未出现在框中
{
"$schema":"https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
"hideSelection":true,
"hideListHeader":true,
"rowFormatter":{
"elmType":"div",
"style":{
"float":"left",
"flex-wrap":"wrap",
"flex-direction":"row",
"width":"600px",
"height":"900px",
"border-radius":"8px",
"margin-right":"10px",
"margin-bottom":"10px",
"box-shadow":"2px 2px 4px darkgrey"
},
"attributes":{
"class":"ms-bgColor-neutralLighterAlt ms-bgColor-neutralLight--hover ms-fontColor-themePrimary--hover"
},
"children":[
{
"elmType":"div",
"__comment:":"DIV 1",
"style":{
"flex-grow":"1",
"display":"flex",
"flex-direction":"column",
"flex-wrap":"nowrap"
},
"children":[
{
"elmType":"div",
"txtContent":"=[$FullName]",
"style":{
"display":"block",
"font-size":"16px",
"font-weight":"bold",
"padding-top":"20px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"Job Title",
"style":{
"display":"block",
"font-size":"14px",
"font-weight":"bold",
"padding-top":"20px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"=[$JobTitle]",
"style":{
"display":"block",
"font-size":"12px",
"font-color":"red",
"font-weight":"normal",
"padding-top":"10px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"Career Interests",
"style":{
"display":"block",
"font-size":"14px",
"font-weight":"bold",
"padding-top":"20px",
"margin-left":"10px",
"margin-right":"10px",
"margin-top":"10px",
"margin-bottom":"10px"
}
},
{
"elmType":"div",
"txtContent":"=[$CareerInterests]",
"style":{
"display":"block",
"font-size":"12px",
"font-weight":"normal",
"padding-top":"10px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"Beginner",
"style":{
"display":"block",
"font-size":"14px",
"font-weight":"bold",
"padding-top":"20px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"=[$SkillLevelBeginner]",
"style":{
"display":"block",
"font-size":"12px",
"font-weight":"normal",
"padding-top":"10px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"Intermediate",
"style":{
"display":"block",
"font-size":"14px",
"font-weight":"bold",
"padding-top":"20px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"=[$SkillLevelIntermediate]",
"style":{
"display":"block",
"font-size":"12px",
"font-weight":"normal",
"padding-top":"10px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"Advanced",
"style":{
"display":"block",
"font-size":"14px",
"font-weight":"bold",
"padding-top":"20px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"=[$SkillLevelAdvanced]",
"style":{
"display":"block",
"font-size":"12px",
"font-weight":"normal",
"padding-top":"10px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"Previous Roles",
"style":{
"display":"block",
"font-size":"14px",
"font-weight":"bold",
"padding-top":"20px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"=[$PreviousRoles]",
"style":{
"display":"block",
"font-size":"12px",
"font-weight":"normal",
"padding-top":"10px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"Qualifications",
"style":{
"display":"block",
"font-size":"14px",
"font-weight":"bold",
"padding-top":"20px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"Primary Qualifications",
"style":{
"display":"block",
"font-size":"14px",
"font-weight":"bold",
"padding-top":"20px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"=[$PrimaryQualifications]",
"style":{
"display":"block",
"font-size":"12px",
"font-weight":"normal",
"padding-top":"10px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"=[$PrimaryDisciplineMajor]",
"style":{
"display":"block",
"font-size":"12px",
"font-weight":"normal",
"padding-top":"10px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"Additional Qualifications",
"style":{
"display":"block",
"font-size":"14px",
"font-weight":"bold",
"padding-top":"10px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType":"div",
"txtContent":"=[$AdditionalQualifications]",
"style":{
"display":"block",
"font-size":"12px",
"font-weight":"normal",
"padding-top":"10px",
"margin-left":"10px",
"margin-right":"10px"
}
},
{
"elmType": "a",
"style": {
"border": "none",
"padding-top": "15px",
"background-color": "transparent",
"color": "#0078d7",
"margin-left":"10px",
"margin-bottom": "20px",
"text-align": "left",
"cursor": "pointer",
"display": "=if([$LinkedIn]=='','none','')"
},
"attributes": {
"target": "_blank",
"iconName": "LinkedInLogo",
"href": "[$LinkedIn]"
}
},
{
"elmType": "a",
"style": {
"border": "none",
"display":"float",
"padding-top": "15px",
"background-color": "transparent",
"color": "#0078d7",
"margin-left":"10px",
"margin-bottom": "20px",
"text-align": "left",
"cursor": "pointer"
},
"attributes": {
"target": "_blank",
"iconName": "CreateMailRule",
"href": "[$FullName.email]",
"title": "Email"
}
}
]
}
]
}
}