Copied to clipboard

Flag this post as spam?

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


  • Craig100 1136 posts 2523 karma points c-trib
    Jan 29, 2015 @ 14:17
    Craig100
    0

    Custom Dropdown Property Editor Issue

    Umb 7.2.1, I need to create a dropdown dataType that allows the setting of Text and Value separately. Working through various property editor tutorials but would like to see the controller.js and package.manifest for the existing dropdown dataType so I can work out how the "Add" button works in the multivalues.html prevalue editor.

    I can't find them anywhere. I guess they could be buried or possibly in a binary, I don't know what the possibilities are. If anyone could tell me where to find them I'd appreciate it :)

    Craig

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jan 29, 2015 @ 16:32
    Jan Skovgaard
    0

    Hi Craig

    I have not had a look for them but was wondering if you could perhaps share your code? I imagine it's a matter of keeping track of an object and make sure to populate it with date whenever a new row is added?

    But perhaps you can browse through the source code to see if you can find what you're looking for here https://github.com/umbraco/Umbraco-CMS/search?utf8=%E2%9C%93&q=dropdown+editor ?

    Have you also had a look in the Angular workbook? https://github.com/umbraco/AngularWorkbook

    /Jan

  • Craig100 1136 posts 2523 karma points c-trib
    Jan 29, 2015 @ 16:49
    Craig100
    0

    Just been told via Twitter the controller is here: https://github.com/umbraco/Umbraco-CMS/tree/5b9a98ad6ae9e63322c26f7b162204e34f7fcb54/src/Umbraco.Web.UI.Client/src/views/propertyeditors/dropdown but the manifest is in code somewhere, which I presume means in a dll. Looking at your link Jan I think it shows it's in a .cs file.  

    Haven't touched Angular before and of course I'm in the inevitable rush for a deadline.  Looks like I'll have to calm down and do some reading, lol

    IF I manage it, I'll share the code.

    Craig

  • Craig100 1136 posts 2523 karma points c-trib
    Jan 29, 2015 @ 17:12
    Craig100
    0

    I can't believe I'm the only person in history who's needed "normal" dropdown functionality.  Am I missing a dataType somewhere that does this already?

    Craig

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Jan 29, 2015 @ 17:24
    Hendy Racher
    1

    Hi Craig,

    There are some DropDown Pickers in nuPickers which can be wired up to a number of datasources.

    How do you want to populate your Drop Down, is it the same for all instances, or do you require dynamic values ?

    HTH,

    Hendy

  • Craig100 1136 posts 2523 karma points c-trib
    Jan 29, 2015 @ 17:51
    Craig100
    0

    Hi Hendy,

    I was just looking at them thanks. Quite like the look of the JSON Dropdown Picker so I'm giving that a go. What I really wanted though was to be able to add data progressivly in the UI rather than have to maintain and upload an extermal file or DB.  This is only the first part of the creation of a larger ArcheType grid. It's to allow the editors to set a code from a list of about a hundred friendly names, then set up other stuff per code, adding as many as they need.

    JSON file created though now so I'll see how it goes.

    Thanks,

    Craig

  • Craig100 1136 posts 2523 karma points c-trib
    Jan 29, 2015 @ 18:19
    Craig100
    0

    If my data is at /App_Data/myfile.json and looks like this:-

    {
        "MyRegions": [
            {"Label":"Australia (au, AUD)", "Region": "au", "Lang":"AU", "Curr":"AUD"},
            {"Label":"Austria (at, EUR)", "Region": "at", "Lang":"DE", "Curr":"EUR"}
    ]

    What do I put in JSONPath, Key JSONPath and LabelJSONPath to output the Label and Region?  Assuming the URL is ~/App_Data/expansysRegions.json.

    Have been testing with http://jsonpath.curiousconcept.com/ but doesn't translate to the picker.

    Thanks,

    Craig

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Jan 29, 2015 @ 18:32
    Hendy Racher
    0

    Hi Craig, just guessing here, but maybe try with your Json file in the root to begin with, just in case it's something to do with that url not being served ?

  • Craig100 1136 posts 2523 karma points c-trib
    Jan 29, 2015 @ 18:37
    Craig100
    0

    Ok, put the file in the root and tried:-

    Url: /MyFile.json

    JSONPath: $.MyRegions[].*

    Key JSONPath: Label

    Label JSONPath: Region

    Relation Mapping: not selected

    Nothing in the dropdown.

    Craig

     

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Jan 29, 2015 @ 18:40
    Hendy Racher
    0

    What if you try ~/MyFile.json ?

  • Craig100 1136 posts 2523 karma points c-trib
    Jan 29, 2015 @ 18:47
    Craig100
    0

    Aha, it now works:)  Thanks for that. However, I can't have this data available to snoopers, so how do I get it to serve from App_Data, which is where I'd expect to put Data:) ?

    I just tried saving it with ~/App_Data/MyFile.json and got an error saying "A pre value with the Alias dataSource already exists for this data type", which was interesting.

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Jan 29, 2015 @ 18:51
    Hendy Racher
    0

    Hi Craig, that should be an easy fix - raised an issue here

  • Craig100 1136 posts 2523 karma points c-trib
    Jan 29, 2015 @ 18:53
    Craig100
    1

    Just for the record, the entries to get it to work were:-

    Url:~ /App_Data/MyFile.json

    JSONPath: $.MyRegions[*]

    Key JSONPath: $..Region

    Label JSONPath: $..Label

    Relation Mapping: not selected

    Don't know why I got the save error earlier, maybe because I had the JSON file in two places. But it's working now, proved by changing data in the JSON file and seeing it reflected in the dropdown. 

    So job done.

    Many thanks Hendy :)

  • Robin Hansen 135 posts 368 karma points
    Jul 17, 2015 @ 13:25
    Robin Hansen
    0

    Hi Craig - I'm in 'urgent' need for such a dropdown as you described your post... - how did you manage it? :)

    \Robin

  • Craig100 1136 posts 2523 karma points c-trib
    Jul 17, 2015 @ 14:40
    Craig100
    0

    Hi Robin - 'fraid I didn't. I had to "rethink" the problem. Ended up using a JSON file and nuPickers. Much more complicated than I thought was necessary for something so obvious (i.e. dropdown as you'd expect in bog-standard HTML).

    Good luck

Please Sign in or register to post replies

Write your reply to:

Draft