Copied to clipboard

Flag this post as spam?

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


  • Jonas Boye 19 posts 131 karma points
    Nov 14, 2013 @ 11:08
    Jonas Boye
    0

    Creating a property editor in Umbraco 7

    Since this is the first time I'm working with Umbraco 7, I have a few questions about property editors. (Using the latest nightly 7.0.0 build 158)

    1. How do i choose the dbType my property should be saved as? It should be saved as NText instead of NVarchar
    2. How do i select custom mediatypes and folders with the MediaPicker? (dialogService.mediaPicker)
    3. How do i hide the label? I've tried two different methods in my package.manifest, but none of them works
    {
        propertyEditors:[
            {
                name:"XXX Editor",
                alias:"XXX.Editor",
    hideLabel: true, editor:{ view:"~/App_Plugins/xxx.Editor/Editor.html", valueType: "JSON" }, prevalues:{ fields:[ { label:"Preview", description:"Display a live preview", key:"preview", view:"boolean" }, { label:"Default value", description:"If value is blank, the editor will show this", key:"defaultValue", view:"textarea" }, { label: "Hide label", description: "", key: "hideLabel", view: "boolean" } ] } } ], javascript:[ "~/App_Plugins/xxx.Editor/Editor.controller.js" ] }
  • Comment author was deleted

    Nov 14, 2013 @ 11:22

    Have you seen Per's latest demo, think it covers some of your questions

    https://github.com/perploug/UkFest-AngularJS-Demo/blob/master/App_Plugins/People/package.manifest

  • Per Ploug 865 posts 3491 karma points MVP admin
    Nov 14, 2013 @ 11:44
    Per Ploug
    5

    1 the DB type is set with the valueType in the manifest:

    valueType: "JSON"

    It can be either "INT", "DATETIME", "STRING" "TEXT" and "JSON"

    string is stored as nvarchar, text is stored as ntext, json is also stored as ntext, but atomatically serialized to a dynamic object

    2 you use a tree-picker instead, as the media picker is focused on providing a simple ui for selecting images, uploading and creating folders, we cant reliably support custom media types for this UI, so a standard treepicker is recommended instead, its availble as dialogService.treePicker(options)

    http://umbraco.github.io/Belle/#/api/umbraco.services.dialogService

    3 that should work, investigating why it doesnt currently

  • Squazz 35 posts 111 karma points
    Nov 09, 2015 @ 14:38
    Squazz
    0

    Oh man have I long been looking for what a valueType can contain :O

  • Per Ploug 865 posts 3491 karma points MVP admin
    Nov 14, 2013 @ 11:55
    Per Ploug
    3

    Right, so this should be the right syntax, will get a full overview up of the manifest today:

    propertyEditors:[
            {
                name:"XXX Editor",
                alias:"XXX.Editor",
                editor:{
                    view:"~/App_Plugins/xxx.Editor/Editor.html",
                    hideLabel: true,
                    valueType: "JSON",
                }, ... etc
    
  • Jonas Boye 19 posts 131 karma points
    Nov 14, 2013 @ 13:05
    Jonas Boye
    100

    Thanks Per, it works! 

     

    I'll look into using tree-picker

  • Per Ploug 865 posts 3491 karma points MVP admin
    Nov 15, 2013 @ 14:36
    Per Ploug
    0

    And a but more background info here:

    http://umbraco.github.io/Belle/#/tutorials/manifest

  • Anders Burla 2560 posts 8256 karma points
    Nov 28, 2013 @ 14:19
    Anders Burla
    0

    Documentation is a bit off. Some times it says that hideLabel is part of the propertyEditor and other times as part of the editor element. What is the right thing? :)

  • Comment author was deleted

    Nov 28, 2013 @ 14:29

    would say editor :)

  • Comment author was deleted

    Nov 28, 2013 @ 14:30

    @anders where is it mentoined otherwise?

  • Jonas Boye 19 posts 131 karma points
    Nov 28, 2013 @ 14:34
    Jonas Boye
    1

    In the sample manifest here: http://umbraco.github.io/Belle/#/tutorials/manifest

    {       
    propertyEditors: [      
        {
        alias: "Sir.Trevor",
        name: "Sir Trevor",
        hideLabel: true,
        valueType: "JSON",
            editor: {
                view: "~/App_Plugins/SirTrevor/SirTrevor.html"
            }
        }
    ],
    javascript: [
        '~/App_Plugins/SirTrevor/SirTrevor.controller.js'
    ]
    

    }

  • John 10 posts 161 karma points
    Jan 31, 2014 @ 15:10
    John
    0

    Ran into this problem too, could the documentation at http://umbraco.github.io/Belle/#/tutorials/CreatingAPropertyEditor be updated to include the valueType: "JSON" property? Is there a repo for the github.io site I can contribute the change to? I couldn't find it after a quick glance through the repos on github.

    edit: valueType, not viewType

  • Joshua 3 posts 23 karma points
    Feb 03, 2014 @ 19:09
    Joshua
    0

    Could it be the documentation is wrong.  When i use JSON as the dataType, it is stored as NVARCHAR(500) and not NTEXT.  Are others seeing this issue as well.

  • John 10 posts 161 karma points
    Feb 05, 2014 @ 13:25
    John
    0

    I had to delete the datatype in the backoffice and create it again after adding valueType: "JSON" to the manifest, the datatype record in the database doesn't get updated on manifest changes.

    edit: valueType, not viewType.

  • Calle Bjernekull 16 posts 38 karma points
    Mar 06, 2014 @ 16:10
    Calle Bjernekull
    0

    @Joshua, I also experience that problem. So if I want to save a JSON-value larger than 500 chars, I get an System.Data.SqlClient.SqlException: "String or binary data would be truncated".

    I tried to change the valueType to STRING and TEXT, but no difference. All values are saved in [dataNvarchar]-column. I also recreated both the property and the datatype after this value was changed in manifest

  • Tom 119 posts 447 karma points
    Mar 31, 2014 @ 21:38
    Tom
    0

    I'm getting the same error now, because of a long json string. Have any of you fixed it?

  • Tom 119 posts 447 karma points
    Apr 07, 2014 @ 10:38
    Tom
    1

    figured out that my package.manifest file was flawed. This tag "valueType: "JSON"" should be inside the editor-tag.

  • Kyle Weems 42 posts 296 karma points MVP 7x c-trib
    Jan 05, 2015 @ 23:52
    Kyle Weems
    0

    I am also experiencing this with valueType JSON, where I need more than 500 characters. Any fix or workaround that can be recommended?

  • Sören Deger 733 posts 2844 karma points c-trib
    Jan 06, 2015 @ 06:55
    Sören Deger
    0

    Hi Kyle,

    modify the dataNvarchar column to be nvarchar(MAX) in database. I think this would help you.

    It's an issue before Version 7.2.0:

    http://issues.umbraco.org/issue/U4-5063

     

    Best regards

    Sören

  • Kyle Weems 42 posts 296 karma points MVP 7x c-trib
    Jan 06, 2015 @ 18:30
    Kyle Weems
    0

    Soren,

    I'm experiencing this problem on an Umbraco 7.2.1 installation with one custom property editor still, with a valueType of JSON. I'm triple-checking my code at this point to find any inconsistencies between it and other property editors, though, just in case it's a bug in the code.

  • Kyle Weems 42 posts 296 karma points MVP 7x c-trib
    Jan 06, 2015 @ 19:32
    Kyle Weems
    0

    Ok, nevermind. There was a very obvious and embarassing bug on my end that I somehow overlooked in my package manifest. >_>;

    All's well. 

  • Abdul Rahim 21 posts 83 karma points
    Aug 13, 2015 @ 09:06
    Abdul Rahim
    1

    Hi Guys

    I have same issue. I tried above steps. It doesn't work.

    So, I changed cmsDataType Table column value of my custom datatype from Nvarchar to Ntext. Its working fine.

    Thanks

Please Sign in or register to post replies

Write your reply to:

Draft