Copied to clipboard

Flag this post as spam?

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


  • Jason Espin 368 posts 1335 karma points
    Dec 10, 2015 @ 12:09
    Jason Espin
    0

    Datatype prevalues - Populate prevalue dropdown based upon previous selection

    Hi all,

    I am currently in the process of building my own tag manager datatype for Umbraco. My datatype can be attached to an document type and allows the user to select a parentNode and a document type. Then, when the user adds a tag using my datatype, a new node of the document type selected is created underneath the selected parentNode with the name set as the tag string that the user entered.

    It is very much like uTagsy but without all of the configuration files and more tightly integrated into Umbraco.

    The problem I face is with my prevalues for my datatype. I only want the user to be able to select document types that are allowed as children of the selected parentNode.

    So, for example, if I have a node of type comments that allows child node document types "comment" and "otherpage" then these items will appear in a dropdown list once the user selects the parentNode prevalue.

    The problem I have, is how do I link my prevalues?

    The following is how I define my property editor along with the parentNode prevalue:

    {
        propertyEditors: [
            {
                alias: "tagliatelle",
                name: "Tagliatelle Tag Editor",
                hideLabel: false,
                valueType: "INT",
                editor: {
                    view: "~/App_Plugins/Tagliatelle/PropertyEditors/TagliatelleEditor.html?v1.0"
                },
    
                prevalues: {
                    fields: [
                        {
                            label: "Tag container",
                            description: "The document type alias under which tags should be stored",
                            key: "containerTag",
                            view: "treepicker",
                            validation: [
                                {
                                    type: "Required"
                                }
                            ]
                        }
                    ]
                }
            }
        ],
    
        javascript: [
            "~/App_Plugins/Tagliatelle/PropertyEditors/Tagliatelle.controller.js?v1.0"
        ]
    }
    

    I was tempted to create a new property editor that comprised of a select list with a value type of string however, this would be in a different scope to my Tag container and therefore I wouldn't be able to access its values. This would also mean that the new property editor would be fairly redundant as it wouldn't work without the tagliatelle tag editor I have created.

    Any advice on how to achieve what I am look to do would be greatly appreciated.

  • Ian 178 posts 752 karma points
    Dec 10, 2015 @ 22:10
    Ian
    0

    Is tree picker a built in property editor view? If it is I think you would have to employ a custom view for configuring pre values for your needs. It would have its own js controller and contain two elements a tree picker and the control for selecting document types. Your controller could then manage the link between the two

  • Jason Espin 368 posts 1335 karma points
    Dec 11, 2015 @ 11:00
    Jason Espin
    0

    The treepicker item was just a hangover from something i tried first. The package.manifest above was just an example of what I am doing with my current property editor.

Please Sign in or register to post replies

Write your reply to:

Draft