Copied to clipboard

Flag this post as spam?

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


  • Robbie van den Hoven 36 posts 159 karma points
    Aug 22, 2017 @ 13:37
    Robbie van den Hoven
    0

    Nexu with nuPicker (checkbox)

    Hi,

    I have a Nupicker checkbox list of nodes you can select. After installing Nexu I was testing if I get a message when I delete a selected node from the content tree. Unfortunately I didn’t got a message, probably because nuPciker isn’t in the supported property editors list.

    Should it already work with nuPicker or is this perhaps a future request?

  • Dave Woestenborghs 3272 posts 11111 karma points MVP 5x admin c-trib
    Aug 22, 2017 @ 14:32
    Dave Woestenborghs
    100

    Hi Robbie,

    I did not support nuPickers. This is because the data in nuPickers isn't necesarry Umbraco Content. You can connect to all types of data sources with nuPickers.

    But I made nexu extensible so you can add your own parsers : https://github.com/dawoe/umbraco-nexu/blob/develop/docs/extending.md

    Here you have some example code of a parser for a nuPickers datatype that stores the valuas as CSV. After you added this to your project you need to register it with Nexu. You can find that in the docs.

    public class CategoryPickerSinglePropertyParser : IPropertyParser
        {       
            public bool IsParserFor(IDataTypeDefinition dataTypeDefinition)
            {
                // check on the name of your nupickers type
                return dataTypeDefinition.Name.Equals("Category picker single");
            }
    
            public IEnumerable<ILinkedEntity> GetLinkedEntities(object propertyValue)
            {
                if (propertyValue == null || string.IsNullOrEmpty(propertyValue.ToString()))
                {
                    return Enumerable.Empty<ILinkedEntity>();
                }
    
                var entities = new List<ILinkedEntity>();
    
                var idArray = propertyValue.ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
    
                foreach (var id in idArray)
                {
                    var attemptId = id.TryConvertTo<int>();
    
                    if (attemptId.Success)
                    {
                        entities.Add(new LinkedDocumentEntity(attemptId.Result));
                    }
                }
    
                return entities;
            }
        }
    

    Dave

  • Dave Woestenborghs 3272 posts 11111 karma points MVP 5x admin c-trib
    Aug 24, 2017 @ 06:10
    Dave Woestenborghs
    0

    Hi Robbie,

    Did you try my suggestion ? Did it work for you ?

    Dave

  • Robbie van den Hoven 36 posts 159 karma points
    Aug 24, 2017 @ 07:03
    Robbie van den Hoven
    0

    Hi Dave,

    Yes, I gave it a try, but was stuck at registering the custom parser. Now with a fresh start (and restart of VS) it works. Thanks a lot!

    Great package and fast support :-)

  • Dave Woestenborghs 3272 posts 11111 karma points MVP 5x admin c-trib
    Aug 25, 2017 @ 09:17
    Dave Woestenborghs
    0

    Hi Robbie,

    Glad to hear you got it working. Maybe you can mark this post as a solution so it others can see it is solved.

    Dave

Please Sign in or register to post replies

Write your reply to:

Draft