SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,249 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am using a choice (multi-selection) and a Yes/No column to achieve the functionality pictured below. However, I would like to be able to only check one of the boxes and have the strike-through be applied to the corresponding choice. I was only able to have all or none.
Here is the code I am using today
Yes/No - Formatting
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"children": [
{
"elmType": "div",
"style": {
"display": "flex",
"flex-direction": "column",
"justify-content": "flex-start",
"flex-wrap": "wrap",
"margin": "5px 0px"
},
"children": [
{
"elmType": "div",
"forEach": "choiceIterator in @currentField",
"style": {
"margin": "1px 0px",
"display": "flex",
"flex-direction": "row",
"align-items": "center"
},
"children": [
{
"elmType": "div",
"txtContent": "[$choiceIterator]",
"style": {
"text-decoration": "=if([$Completed],'line-through','inherit')",
"margin": "1.5px"
},
"attributes": {
"class": "ms-fontColor-black"
}
}
]
}
]
}
]
}
Choice Column Formatting
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"children": [
{
"elmType": "div",
"style": {
"display": "flex",
"flex-direction": "column",
"justify-content": "flex-start",
"flex-wrap": "wrap",
"margin": "5px 0px"
},
"children": [
{
"elmType": "div",
"forEach": "choiceIterator in [$Tasks]",
"style": {
"margin": "3px 0px",
"display": "flex",
"flex-direction": "row",
"align-items": "center",
"cursor": "pointer"
},
"children": [
{
"elmType": "div",
"style": {
"margin-right": "5px",
"padding-top": "3px"
},
"attributes": {
"iconName": "=if(@currentField, 'CheckboxComposite','Checkbox')"
},
"customRowAction": {
"action": "setValue",
"actionInput": {
"Completed": "=if(@currentField , '0' , '1' )"
}
}
}
]
}
]
}
]
}