How to add values to radiobuttonlist prevalue editor
I am in the process of creating a custom property editor and want to have three choices for one specific prevalue.
In this specific case I want to give the ability to select between three different editors, but the problem I have is to get anything showing.
prevalues: {
{
label: "Type of editor",
description: "The type of editor for this data type",
key: "typeofeditorkey",
view: "radiobuttonlist"
//What do I put here to get values?
}
]
}
I have tried to look at all the existing documentation and searching google for hours, trying different stuff from looking at the radiobuttonlist.html view but so far no luck.
It is not possible to set prevalues for the radiobuttonlist prevalue editor. It is only used for Grid Layouts atm. I have logged a feature request on the issue tracker to make it usable from package.manifest.
In the mean time I think the best option would be to make a custom prevalue editor. Something like this:
1: Create a folder in /App_Plugins/ call it radiobuttonprevalue
2: Create three files in /App_Plugins/radiobuttonprevalue/, package.manifest, radiobuttonprevalue.controller.js and radiobuttonprevalue.html.
3: In package.manifest all we have to do is make sure the controller is added to Umbraco so:
I should have suspected that it was a bug before I banged my head against the wall...
This really did what I needed, the only difference I made was to have objects instead of strings for the prevalue options, to be able to separate the label from the actual value.
How to add values to radiobuttonlist prevalue editor
I am in the process of creating a custom property editor and want to have three choices for one specific prevalue. In this specific case I want to give the ability to select between three different editors, but the problem I have is to get anything showing.
I have tried to look at all the existing documentation and searching google for hours, trying different stuff from looking at the radiobuttonlist.html view but so far no luck.
Can anyone give me any pointers?
Hi Viktor
It is not possible to set prevalues for the radiobuttonlist prevalue editor. It is only used for Grid Layouts atm. I have logged a feature request on the issue tracker to make it usable from package.manifest.
In the mean time I think the best option would be to make a custom prevalue editor. Something like this:
1: Create a folder in
/App_Plugins/
call itradiobuttonprevalue
2: Create three files in
/App_Plugins/radiobuttonprevalue/
,package.manifest
,radiobuttonprevalue.controller.js
andradiobuttonprevalue.html
.3: In
package.manifest
all we have to do is make sure the controller is added to Umbraco so:4: In
radiobuttonprevalue.controller.js
you set the prevalues you want:5: You can use the view from the radiobuttonlist.html, all you need to add is the controller, so radiobuttonprevalue.html would look like:
And that's it. Prevalue editor done!
To use it simply add it to your custom editors
package.manifest
file:and now you get a radiobuttonlist with 3 options :)
The value selected will be available on the property editor in
$scope.model.config.options
.Hope this helps
/rune
Thanks Rune!
This answer was spot on!
I should have suspected that it was a bug before I banged my head against the wall...
This really did what I needed, the only difference I made was to have objects instead of strings for the prevalue options, to be able to separate the label from the actual value.
You really made my day :-)
is working on a reply...