Changing valueType in custom propertyEditor not working!
Hi everyone!
I've just created a custom property editor which has been working pretty fine up until now. I'm getting a checkbox list from a service and storing the selected values in umbraco. The thing is, by default, any custom property editor stores values in the [dataNvarchar] column in the database and recently, when we tried to save a string bigger than 500 characters, the backoffice reacts like this:
TypeError: data.indexOf is not a function (and so on...)
Now, it didn't take long to realize that the problem was the fact that I was exceeding the 500 character limit, so I looked for a way of changing the dataType and I found this tutorial on the package.manifest: http://umbraco.github.io/Belle/#/tutorials/manifest
So, I've tried with both valueType: "TEXT" and valueType: "JSON" attributes (since both store values in dataNtext) to my property editor in the package.manifest, cleared the browser cache, restarted the app pool, and... nothing happened! It keeps on getting the value from the dataNvarchar instead of dataNtext column and storing in it (which is what I want/need).
The manifest looks good to me, changes to the manifest needs an application restart for Umbraco to pick up on them, but the app pool recycle should have triggered that ?
As the cache is really rather aggressive, I'd be tempted to add
hideLabel: true,
to your editor config section in the manifest above, restart the application and see if Umbraco finds that new configuration setting and hides the label of the property editor.
Ie not a solution, just a sanity check - is it Umbraco not picking up on the new value for valueType or is it just not storing in the correct database field for JSON !!
Thanks for the reply! Trust me... I had quite a few sanity checks the past few hours. The hide label worked immediately but the valueType is still being ignored! :(
Everytime I change the package.manifest, I restart the app pool (by adding a space on the web.config) and I'm also working with cache disabled on the browser.
As mentioned, I've tried with both JSON and TEXT... none worked!
It's driving me mad... :( Oh... and by the way... just saying that the property editor works like a charm! It does read/write perfectly... just on the wrong dataType! :P
SELECT TOP 1000 [pk]
,[nodeId]
,[propertyEditorAlias]
,[dbType]
FROM [cmsDataType]
manually change the dbType in there to be Ntext for your propertyEditorAlias
I think what is happening is when you first create a property editor, it creates an entry in that table, and sets the dbType, I suspect that changing the valueType in manifest doesn't update the table after the editor has been created the first time!!
Stupid me! It never occurred to me doing that, considering that there used to be (in previous versions of Umbraco) a dropdown for us to choose the dbType, so of course it should be stored somewhere in the database.
As soon as I'll make a new property editor, I'll change the valueType from the begining and confirm that theory but you're probably right! At least it's working now... ;)
Changing valueType in custom propertyEditor not working!
Hi everyone!
I've just created a custom property editor which has been working pretty fine up until now. I'm getting a checkbox list from a service and storing the selected values in umbraco. The thing is, by default, any custom property editor stores values in the [dataNvarchar] column in the database and recently, when we tried to save a string bigger than 500 characters, the backoffice reacts like this:
and on the console I get this:
POST http://localhost:57462/umbraco/backoffice/UmbracoApi/Content/PostSave 500 (Internal Server Error)
TypeError: data.indexOf is not a function (and so on...)
Now, it didn't take long to realize that the problem was the fact that I was exceeding the 500 character limit, so I looked for a way of changing the dataType and I found this tutorial on the package.manifest: http://umbraco.github.io/Belle/#/tutorials/manifest
So, I've tried with both valueType: "TEXT" and valueType: "JSON" attributes (since both store values in dataNtext) to my property editor in the package.manifest, cleared the browser cache, restarted the app pool, and... nothing happened! It keeps on getting the value from the dataNvarchar instead of dataNtext column and storing in it (which is what I want/need).
My package.manifest:
Any ideas on why?!
Thanks! :)
Hi Cesar
The manifest looks good to me, changes to the manifest needs an application restart for Umbraco to pick up on them, but the app pool recycle should have triggered that ?
As the cache is really rather aggressive, I'd be tempted to add
hideLabel: true,
to your editor config section in the manifest above, restart the application and see if Umbraco finds that new configuration setting and hides the label of the property editor.
Ie not a solution, just a sanity check - is it Umbraco not picking up on the new value for valueType or is it just not storing in the correct database field for JSON !!
Hi Marc!
Thanks for the reply! Trust me... I had quite a few sanity checks the past few hours. The hide label worked immediately but the valueType is still being ignored! :(
Everytime I change the package.manifest, I restart the app pool (by adding a space on the web.config) and I'm also working with cache disabled on the browser.
As mentioned, I've tried with both JSON and TEXT... none worked! It's driving me mad... :( Oh... and by the way... just saying that the property editor works like a charm! It does read/write perfectly... just on the wrong dataType! :P
Any other thoughts on this?
Cheers!
Hi Cesar
Check the SQL Database cmsDataType table
manually change the dbType in there to be Ntext for your propertyEditorAlias
I think what is happening is when you first create a property editor, it creates an entry in that table, and sets the dbType, I suspect that changing the valueType in manifest doesn't update the table after the editor has been created the first time!!
regards
Marc
You totally rock... It worked!!! :D
Stupid me! It never occurred to me doing that, considering that there used to be (in previous versions of Umbraco) a dropdown for us to choose the dbType, so of course it should be stored somewhere in the database.
As soon as I'll make a new property editor, I'll change the valueType from the begining and confirm that theory but you're probably right! At least it's working now... ;)
Thanks for your help!
César
Great, the property editor is back on track!
I was going to raise an Issue on the tracker for the problem; but actually one already exists:
http://issues.umbraco.org/issue/U4-6050
so have commented the fix above; and voted it up!
is working on a reply...