Ideally, I want an editor user in the back office to be able to go into a Row's settings, check or uncheck a box, and:
If checked, apply a css class
If not checked, don't do anything
Has anyone accomplished this / have a good example of how to do this?
Best,
Chris
Edit:
After working on this the proper method (I believe) is to use a radiobuttonlist with prevalues.
So I went down that path, but I'm unable to get the "class" of "restrictContentWidth" applied properly. Instead it's applying the class under the "style" section of the DOM.
Any ideas how to fix this?
Screenshot of the improper DOM rendering:
Screenshot of my settings in action:
Here's the styles I've added in under the "Grid" datatype:
[
{
"label": "Set a background image",
"description": "Set a row background",
"key": "background-image",
"view": "imagepicker",
"modifier": "url({0})"
},
{
"label": "Background Hex Color",
"description": "Set a background color in hex format, such as: #FFF000",
"key": "background-color",
"view": "textstring",
"icon": "icon-paint-roller",
"config": {
"style": "background-color:#{0}"
}
},
{
"label": "Restrict Content Width",
"description": "Enable if you would like this row to have its content width restricted. You should only enable this if Full Width Grid Layout is enabled.",
"key": "class",
"view": "radiobuttonlist",
"prevalues": [
{
"label": "Not Enabled",
"value": "none"
},
{
"label": "Enable Width Restriction",
"value": "restrictContentWidth"
}
],
"applyTo": "row"
}
]
Edit #2
I found the answer after reading a bunch of blog posts about grid editor styles and settings.
I solved this by moving the "style" to the "settings" portion of the grid settings. Grid settings let you apply classes and do other things, but styles seem to be designed only modify / extend the "style" attribute.
The problem with this then is the limitation of setting multiple class values. The radiobuttonlist will 'set' the value of 'class' if you have one setup (I do) and then there's no way to "unselect" a choice from radiobuttonlist to enable you to use the "class" textstring again.
Grid Editor Style is Improperly Rendering "Class" under "Style"
Does anyone have an example of how Umbraco grid styles/properties work for booleans? https://our.umbraco.org/documentation/getting-started/backoffice/property-editors/built-in-property-editors/grid-layout/settings-and-styles
Ideally, I want an editor user in the back office to be able to go into a Row's settings, check or uncheck a box, and:
Has anyone accomplished this / have a good example of how to do this?
Best, Chris
Edit:
After working on this the proper method (I believe) is to use a radiobuttonlist with prevalues.
So I went down that path, but I'm unable to get the "class" of "restrictContentWidth" applied properly. Instead it's applying the class under the "style" section of the DOM.
Any ideas how to fix this?
Screenshot of the improper DOM rendering:
Screenshot of my settings in action:
Here's the styles I've added in under the "Grid" datatype:
I think this has got to be a bug, so I submitted the issue here. Has anyone gotten this to work?
http://issues.umbraco.org/issue/U4-9219
Edit It does look like this has been possible in the past, example this post: https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/63142-umbraco-7-data-types-grid-settings-view-boolean
Edit #2 I found the answer after reading a bunch of blog posts about grid editor styles and settings. I solved this by moving the "style" to the "settings" portion of the grid settings. Grid settings let you apply classes and do other things, but styles seem to be designed only modify / extend the "style" attribute.
The problem with this then is the limitation of setting multiple class values. The radiobuttonlist will 'set' the value of 'class' if you have one setup (I do) and then there's no way to "unselect" a choice from radiobuttonlist to enable you to use the "class" textstring again.
is working on a reply...