Copied to clipboard

Flag this post as spam?

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


  • Søren Friis Dam 2 posts 23 karma points
    Apr 24, 2014 @ 11:25
    Søren Friis Dam
    1

    Set label template in Archetype using Multinode Treepicker

    How do I set the label to show e.g. the document name instead of the document id while using a Multinode Treepicker. This info is not in the json so is there a helper method in Umbraco that I can use for this.

    To get the document id I use {{product}} in the data type label

    It would be nice that the image below said "Reveal 802" in the lable instead of "1058" and "Flashback Delay" instead of "1081"

    Archetype Showing Document ID in label

  • Heather Floyd 604 posts 1002 karma points MVP 5x c-trib
    Aug 08, 2014 @ 17:08
    Heather Floyd
    0

    I'd love this feature also!

  • Warren Buckley 2106 posts 4836 karma points MVP ∞ admin hq c-trib
    Aug 08, 2014 @ 18:03
    Warren Buckley
    0

    Hi Soren,
    Yes it can be done but would most likely require the Archetype guys to modify the underlying code a little.

    But with an AngularJS service/resource that the Umbraco core guys have written the content node could be querried from the ID you have stored and get more data like the node name in your case.

    http://umbraco.github.io/Belle/#/api/umbraco.resources.contentResource

    contentResource.getById(1234).then(function(content) {
       var myDoc = content; 
       alert('its here!');
    });
    
  • Heather Floyd 604 posts 1002 karma points MVP 5x c-trib
    Aug 08, 2014 @ 18:48
    Heather Floyd
    0

    Awesome, Warren! Thanks for the tip. If I felt more comfortable with Angular I'd try to implement that in the Archetype source. Maybe in a few weeks ;-)

  • Warren Buckley 2106 posts 4836 karma points MVP ∞ admin hq c-trib
    Aug 08, 2014 @ 19:02
    Warren Buckley
    0

    Unfortunately I do not have the time to do a Pull Request to the Archetype guys, but if you bring it to their attention & link back to this thread as reference about the implementation then they would easily be able to do it :)

    Cheers,
    Warren :)

  • shinsuke nakayama 109 posts 250 karma points
    Sep 09, 2014 @ 08:46
    shinsuke nakayama
    2

    Hi guys,

    I had a same issue and I did a quick fix. and i thought i'll share with you guys.

    I'm not sure if this is the efficient ways of doing it but it works :)

    NOTE: I'm not a Archetype developer or Umbraco official developer

    archetype.js @ line 191

        $scope.getPropertyValueByAlias = function(fieldset, propertyAlias) {
                var property = _.find(fieldset.properties, function(p) {
                    return p.alias == propertyAlias;
                });
    
    //here
                if (property.propertyEditorAlias == "Umbraco.ContentPickerAlias") {
                    var data = ArchetypeLabels.GetFirstDocumentEntityName($scope, property.value);
                    return data;
                }
    //to here
                return (typeof property !== 'undefined') ? property.value : '';
            };
    

    Cheers Shinsuke

Please Sign in or register to post replies

Write your reply to:

Draft