Hello everyone, I'm new to umbraco and I was wondering is there possibility to create a new data type without having to use angularjs? Thank you all for the availability
Hi Alex, I have to create a specific property editor for an entity of MD CRM, just not knowing angularjs I was wondering if it was possible to create a new property editor without using angularjs.
hello David, as I said I'm not a maximum of umbraco and its operation, you would have a simple example to show me so as to try to create a simple property editor. Thank you for your availability
as said there is not much to do.
The attribute:
[PropertyEditor("EventCalendar.CalendarPicker", "EventCalendar CalendarPicker", "dropdown", IsParameterEditor = true, ValueType = "int")]
The properties are the alias of the editor, the display name, the type of the editor; in this case a dropdown - could also be datetimepicker or something else. IsParameterEditor specifies if the editor can also be used in macros and ValueType which value is returned.
If you just want to provide a property editor with no custom logic than you don't have anything to do besides the attribute and inheriting the class.
If you need custom logic then you can override the method "CreateValueEditor". In that method you can for example gather custom data which you want to show in a dropdown. In my case a have a list of "calendar" which I want to make selectable in the dropdown which then looks like this:
var dictionary = new Dictionary<int, string>();
dictionary.Add(0, "All calendar");
calendar.ToList().ForEach(c => dictionary.Add(c.Id, c.Name));
base.DefaultPreValues.Add("items", dictionary);
var preValues = calendar.Select(x => new PreValue(x.Id, x.Name)).ToList();
preValues.Insert(0, new PreValue(0, "All calendar"));
editor.ConfigureForDisplay(new PreValueCollection(preValues));
But that of course depends on what type of data you want to handle. Have a look at the properties which are available and the methods. It's mostly trial & error.
Create a new data type without using angularjs
Hello everyone, I'm new to umbraco and I was wondering is there possibility to create a new data type without having to use angularjs? Thank you all for the availability
Hi Davide
Did you mean "property editor"?
Umbraco version 7 works only with angular property editors.
Thanks,
Alex
Hi Alex, I have to create a specific property editor for an entity of MD CRM, just not knowing angularjs I was wondering if it was possible to create a new property editor without using angularjs.
Hi Davide,
you can create Property Editors with C# code. It basically is a class which inherits from PropertyEditor class and has an Attribute on it like this:
Hope that gets you started.
Regards David
hello David, as I said I'm not a maximum of umbraco and its operation, you would have a simple example to show me so as to try to create a simple property editor. Thank you for your availability
Hi Davide,
as said there is not much to do. The attribute: [PropertyEditor("EventCalendar.CalendarPicker", "EventCalendar CalendarPicker", "dropdown", IsParameterEditor = true, ValueType = "int")]
The properties are the alias of the editor, the display name, the type of the editor; in this case a dropdown - could also be datetimepicker or something else. IsParameterEditor specifies if the editor can also be used in macros and ValueType which value is returned.
If you just want to provide a property editor with no custom logic than you don't have anything to do besides the attribute and inheriting the class.
If you need custom logic then you can override the method "CreateValueEditor". In that method you can for example gather custom data which you want to show in a dropdown. In my case a have a list of "calendar" which I want to make selectable in the dropdown which then looks like this:
But that of course depends on what type of data you want to handle. Have a look at the properties which are available and the methods. It's mostly trial & error.
Regards David
is working on a reply...