Copied to clipboard

Flag this post as spam?

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


  • Steve Larsen 8 posts 28 karma points
    Aug 13, 2012 @ 19:07
    Steve Larsen
    0

    Custom DataType needs custom Generic Properties

    Hi, my project requires a custom datatype that I've created by following Tim's blog about AbstractDataEditor. I have a prevalueeditor which works fine for setting global values into the datatype but what i need now is a way to enter custom settings about the instance of the control on a document.

    My document might have several properties of the new datatype, I need to be able to set a unique value for each instance.

    In short, I need to extend GenericProperties.ascx and have this control loaded when the property containing my datatype is expanded.

    Any thoughts how to do this, or is there another approach I am not considering?

     

  • SC Digital Services Team 104 posts 171 karma points
    Aug 14, 2012 @ 14:40
    SC Digital Services Team
    0

    Hi Steve,

    How will this unique value be used?

    If it is just for reference, then the name and alias of each instance of your datatype should suffice. If it is to influence how each instance of your datatype will behave/be rendered then it might be easier for you add those settings to your prevalueeditor, and create a new Data Type (based on your custom type) for each instance. E.G. "Datatype1 - with option Y", "Datatype1 - with option Z".

    If you go down the latter approach and want to have a common/share set of prevalues, take a look at the following blog by Mike Taylor: http://umbraco.miketaylor.eu/2011/02/10/creating-a-custom-data-editor-setting-type/ for inheriting data from other data editor settings

    If you just want a set of prevalues, with a different set of controls/data for the user, then some of Tim's other blog posts may be useful to you:
    http://www.nibble.be/?cat=25
    http://www.nibble.be/?m=201012

    http://labs.thesedays.com/blog/2011/04/26/a-specialized-data-type-for-umbraco/ - a useful example of prevalues used to set the user controls, and shows how to use data classes & XML serialisation to store data.

    Hope this helps!

     

  • Steve Larsen 8 posts 28 karma points
    Aug 14, 2012 @ 16:10
    Steve Larsen
    0

    Thank you, I just glanced over Tim's blog and it looks like the "3 classes" approach where you implement IDataEditor is exactly what I am looking for. If I have any othe questions I will post them here.

    Best regards, Steve

  • SC Digital Services Team 104 posts 171 karma points
    Aug 14, 2012 @ 16:25
    SC Digital Services Team
    0

    Glad to help - just remember to mark my reply above as the solution for your question. This will help others identify this thread as a potential source of information/solution when searching this forum.

  • Steve Larsen 8 posts 28 karma points
    Aug 17, 2012 @ 20:08
    Steve Larsen
    0

    Sorry to report back but the links to Tim's blogs do not appear to solve my problem.

    I have already created a custom DataType with prevalue settings.  What I need now is for when I drop the control onto a Document I need some additional settings that can be associated with that specific instance of the DataType.

    For example: Settings->Document Types-><my Document>->Generic Properties->Add new Property-><insert my new DataType> displays Generic Properties for the control such as Name, Alias, Type, Tab. etc.  The control used for this display is called GenericProperties.ascx (located in controls\GenericProperties).

    I need to create a new usercontrol similar to GenericProperties.ascx, display it when my DataType's properties are being edited on the Document in which it has been placed, and save/retrieve those properties.

    Thank you, Steve

  • SC Digital Services Team 104 posts 171 karma points
    Aug 20, 2012 @ 17:37
    SC Digital Services Team
    0

    OK - not sure how to do that, but definitely intererested to hear if you find a way of doing it (it might solve a few of our requirements)!

    Just out of interest - what additional settings are you hoping to implement through a custom GenericProperties control?

     

  • Steve Larsen 8 posts 28 karma points
    Aug 20, 2012 @ 19:25
    Steve Larsen
    0

    Looks I need to change the xml to reflect the additional properties in the user control but not sure how I tell the datatype to use a different editor instead of genericproperties.  So for now I'm dummying data in the alias field.

    Basically I have a new custom datatype that provides image upload and formatting beyond what the media control provides, via its prevalueeditor I can set image restrictions, e.g. size, resolution, format, etc.  After dropping this control onto a document I need to specify what the physical save file name is to be, the site knows what filename to look for.  I don't want the user to know about the physical filename, all the user needs to do upload an image.  The datatype verifies the image size, etc. then during Save I need to retrieve the physical file name.  Right now I'm planting it into the Alias , eg. "iOS_background_splash_png" but this is not ideal.

    thanks for your interest.

  • SC Digital Services Team 104 posts 171 karma points
    Aug 21, 2012 @ 17:18
    SC Digital Services Team
    0

    Now that would be useful - sounds like that could be built upon a feature that is already on the roadmap for 4.9.0, that adds an interface for custom datatypes to access the property information - http://issues.umbraco.org/issue/U4-165

    Might be worth putting in a request for this to be a new feature - http://our.umbraco.org/contribute/report-an-issue-or-request-a-feature - we'd vote for it!

Please Sign in or register to post replies

Write your reply to:

Draft