Copied to clipboard

Flag this post as spam?

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


  • Niels Henriksen 73 posts 276 karma points
    Jan 22, 2018 @ 22:52
    Niels Henriksen
    0

    Multiple types of Child Items

    I am making a website where a node can have multiple child-types and I want to be able to group them in the "Child items" editor.

    Is that possible?

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Jan 22, 2018 @ 22:53
    Alex Skrypnyk
    0

    Hi Niels

    What did you mean the "Child items" editor?

    There is a list view for child nodes - https://24days.in/umbraco-cms/2016/custom-list-view-layouts/

    Alex

  • Niels Henriksen 73 posts 276 karma points
    Jan 23, 2018 @ 08:50
    Niels Henriksen
    0

    Yes its that.

    Right now I have 2 doctypes as childs and I want them as 2 lists and not one.

  • Marcio Goularte 388 posts 1360 karma points
    Jan 23, 2018 @ 09:58
  • Niels Henriksen 73 posts 276 karma points
    Jan 23, 2018 @ 10:02
    Niels Henriksen
    0

    Thanks... I will :)

  • Niels Henriksen 73 posts 276 karma points
    Jan 24, 2018 @ 12:02
    Niels Henriksen
    0

    YES!! I found the solution. Just need to code my custom layout controller so I can show 2 lists with separate document type

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Jan 24, 2018 @ 12:16
    Alex Skrypnyk
    0

    Hi Niels

    Thanks for sharing with our community the solution!

    Have a great day.

  • Niels Henriksen 73 posts 276 karma points
    Jan 24, 2018 @ 14:47
    Niels Henriksen
    100

    The solution is (I only show the nessary code)

    controller

    function activate() {
                $scope.listIngredients = {};
                $scope.listComments = {};
    
                angular.forEach($scope.items, function (item,key) {
                    if(item.contentTypeAlias == 'ingredient')
                    {
                        $scope.listIngredients[key] = item;
                    }
                    if(item.contentTypeAlias == 'comment')
                    {
                        $scope.listComments[key] = item;
                    }
    
                });
            }
    

    html file

                        <tr ng-repeat="ingredient in listIngredients" id="{{ingredient.id}}">
                            <td><a href="#">{{ingredient.name}}</a></td>
                            <td>{{ingredient.contentTypeAlias}}</td>
                        </tr>
    

    and in the next table

                        <tr ng-repeat="comment in listComments" id="{{comment.id}}">
                            <td><a href="#">{{comment.name}}</a></td>
                            <td>{{comment.contentTypeAlias}}</td>
                        </tr>
    

    when you understand it its very easy :D

  • Søren Kottal 712 posts 4570 karma points MVP 6x c-trib
    Jan 25, 2018 @ 18:53
    Søren Kottal
    0

    From my experience, that only works, as long as you have all your child nodes on the same page in the list view. So if you have a page size of 10, and have 20 ingredients, og 50 comments. You might end up with page 1 of your listview containing 10 ingredients and no comments. Page 2 could have 4 comments og 6 ingredients etc. etc.

  • Niels Henriksen 73 posts 276 karma points
    Jan 26, 2018 @ 18:27
    Niels Henriksen
    0

    Yes there can be a problem. I havent found out yet how to make 2 tabs - one with ingredients and one with comments.

Please Sign in or register to post replies

Write your reply to:

Draft