AnsweredAssumed Answered

Aikau: How to render array - parameter of items in list?

Question asked by npavlov on Mar 21, 2018
Latest reply on Apr 26, 2018 by npavlov

Hi, 

I have a response from server:

{
...
"relatedItems": [
         {
   "links": [
   {
     "rel": "self1",
     "href": "123456789"
   },
   {
      "rel": "self2",  
      "href": "987654321"
    }
   ],
   "name": "Item-1",
   "description": "This is a description for item1"
},
{
 "links": [...]
"name": "Item-2",
"description": "Thisis a description for item2"
},
...
]
}

VARIABLES

 
I have such widget structure:
{
    name: "alfresco/lists/AlfSortablePaginatedList"
    config: {
        loadDataPublishTopic: "ALF_CRUD_GET_ALL",
        loadDataPublishPayload: {
            url: "...url_of_repo..."
        },
        itemsProperty: "relatedItems"
        widgets: [
            {
                name: "alfresco/lists/views/AlfListView",
                config: {
                    additionalCssClasses: "bordered",
                    widgets: [
                        {
                            name: "alfresco/lists/views/layouts/Row",
                            config: {
                                widgets: [
                                    {
                                        name: "alfresco/lists/views/layouts/Cell",
                                        config: {
                                            additionalCssClasses: "mediumpad",
                                            style:"width:235px;",
                                            widgets: [
                                                {
                                                    name: "alfresco/layout/HorizontalWidgets",
                                                    config: {
                                                        widgets: [
                                                            {
                                                                name: "alfresco/renderers/Selector",
                                                                widthPx: "20",
                                                            },
                                                            {
                                                                name: "alfresco/layout/VerticalWidgets",
                                                                widthPx: "110",
                                                                config: {
                                                                    widgets: [
                                                                        {
                                                                             name: "alfresco/renderers/Property",
                                                                             config: {
                                                                                 propertyToRender: "name"
                                                                             }
                                                                        },
                                                                        {
                                                                            name: "alfresco/lists/AlfList",
                                                                            config: {
                                                                                itemsProperty: "links",
                                                                                widgets: [
                                                                                    {
                                                                                        name: "alfresco/lists/views/HtmlListView",
                                                                                        config: {
                                                                                            propertyToRender: "href"
                                                                                        }
                                                                                    }
                                                                                ]
                                                                            }
                                                                        }
                                                                    ]
                                                                }
                                                            }
                                                        ]
                                                    }
                                                }
.....................................................
                    ]
                }
            }

        ]

    }
},

So i see a list of items from "relatedItems", but how to make a list of "links" for each item? As you can see I try to use another AlfList for that, but how to get items from second level array "links"?

Finally I want to have a table with elements - items from "relatedItems" array. And one column is lists of items from "links" array for each high level item.

Outcomes