Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • César Silva 3 posts 83 karma points
    Sep 02, 2015 @ 10:20
    César Silva
    0

    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:

    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:

    {
        propertyEditors: [
            {
                alias: "SurroundingTypesSelector", 
                name: "Surrounding types selector",
                editor: {
                    view: "~/App_Plugins/SurroundingTypesSelector/selector.editor.html",
                    valueType: "JSON"
                }
            }
        ], 
    
        javascript: [
            "~/App_Plugins/SurroundingTypesSelector/selector.controller.js"
        ]
    }
    

    Any ideas on why?!

    Thanks! :)

  • Marc Goodson 2149 posts 14377 karma points MVP 9x c-trib
    Sep 02, 2015 @ 16:26
    Marc Goodson
    0

    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 !!

  • César Silva 3 posts 83 karma points
    Sep 02, 2015 @ 18:20
    César Silva
    0

    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!

  • Marc Goodson 2149 posts 14377 karma points MVP 9x c-trib
    Sep 02, 2015 @ 19:59
    Marc Goodson
    100

    Hi Cesar

    Check the SQL Database cmsDataType table

    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!!

    regards

    Marc

  • César Silva 3 posts 83 karma points
    Sep 03, 2015 @ 10:34
    César Silva
    0

    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

  • Marc Goodson 2149 posts 14377 karma points MVP 9x c-trib
    Sep 03, 2015 @ 20:43
    Marc Goodson
    0

    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!

Please Sign in or register to post replies

Write your reply to:

Draft