Difference between a property editor and data type
I ran across some blogs that define the multinode tree picker as a data type. I thought that was a property editor. what's the difference between these two concepts? Thanks
When you define Properties in Umbraco on your Document Type - those Properties have a Data Type, and the Data Type is implemented by the Property Editor (really for consistency the Data Type should be called a Property Type!!!!)
Let's think of an example.
If you wanted to have a textbox that had a character limit applied to it, so the editors could only type 50 characters (more would break the lovely design), you could create a Custom Property Editor, that displayed a textbox and a message saying how many characters were left to type... and stop the editor from adding more after 50 were reached.
But what if you had another texbox that had a bigger character limit? you'd have to create the same property editor again, and duplicate all the implementation code, just to change the limit to 200 characters. Everything else would be the same.
So it's possible to configure 'PreValues' for a Property Editor - so here we'd add a 'Character Limit' PreValue and change our Property Editor code to use this value so we only had to implement the functionality of character limiting once.
But where would you change the value?
This is where the Data Type comes in, you would be able to create multiple Data Types, all using the same underlying Property Editor, but specifying different 'Character Limits'
It's the Data Type that gets added to the Document Type.
So the Data Type is like a particular configured instance of a Property Editor.
If that makes sense?
When there aren't prevalues to configure on the property editor, then it feels a bit strange to be adding a DataType, of pretty much the same name as the editor, just to be able to add it to a Document Type! hence the concepts are easily confused.
Difference between a property editor and data type
I ran across some blogs that define the multinode tree picker as a data type. I thought that was a property editor. what's the difference between these two concepts? Thanks
Hi Blackhawk
A Data Type is a 'wrapper' for a Property Editor.
When you define Properties in Umbraco on your Document Type - those Properties have a Data Type, and the Data Type is implemented by the Property Editor (really for consistency the Data Type should be called a Property Type!!!!)
Let's think of an example.
If you wanted to have a textbox that had a character limit applied to it, so the editors could only type 50 characters (more would break the lovely design), you could create a Custom Property Editor, that displayed a textbox and a message saying how many characters were left to type... and stop the editor from adding more after 50 were reached.
But what if you had another texbox that had a bigger character limit? you'd have to create the same property editor again, and duplicate all the implementation code, just to change the limit to 200 characters. Everything else would be the same.
So it's possible to configure 'PreValues' for a Property Editor - so here we'd add a 'Character Limit' PreValue and change our Property Editor code to use this value so we only had to implement the functionality of character limiting once.
But where would you change the value?
This is where the Data Type comes in, you would be able to create multiple Data Types, all using the same underlying Property Editor, but specifying different 'Character Limits'
It's the Data Type that gets added to the Document Type.
So the Data Type is like a particular configured instance of a Property Editor.
If that makes sense?
When there aren't prevalues to configure on the property editor, then it feels a bit strange to be adding a DataType, of pretty much the same name as the editor, just to be able to add it to a Document Type! hence the concepts are easily confused.
regards
Marc
Thank you for such a detailed explanation! Yes it makes sense. I feel this helps me to have a better undestanding on both areas.
is working on a reply...