AnsweredAssumed Answered

Can I iterate on array in ALFDocumentListView

Question asked by anand.mohan@nike.com on Jun 26, 2015
Hi ,

I want to print elements in list and have an inline edit button as well. I cannot use AlfList and its publosh topic as I am on a dialog box and it seems, from a dialog box if AlfList is called, it's topic cannot be published. I tried this several times.

What I am trying is that I have an array and I am trying to iterate over it and trying to print them, but this is not happening. Below is the code.
Please let me know if this can be done and if yes ,what wrong I am doing below. Thanks a lot !!!

{
                            name: "alfresco/forms/ControlRow" ,
                            config: {
                                widgets:
                                    buildViews(assetCategoryArray)
                            }

                           }

function buildViews(seasonJsonProp) {

    var views = [];

    // Get all the data list types…
    var dataListTypes = seasonJsonProp;
        // Iterate over each data list type and get its properties…
        for (var i = 0; i < dataListTypes.length; i++)
        {
            var rowWidgets = [];

            var currentView = {
                id:"CAT_ELE_LIST",
                name: "alfresco/documentlibrary/views/AlfDocumentListView",
                config: {
                    widgets: [
                        {
                            id:"CAT_ELE_LIST_ROW",
                            name: "alfresco/documentlibrary/views/layouts/Row",
                            config: {
                                widgets: [
                                    {
                                        id:"CAT_ELE_LIST_ROW_CELL",
                                        name: "alfresco/documentlibrary/views/layouts/Cell",
                                        config: {
                                            widgets: [
                                                {
                                                    name: "alfresco/html/Label",
                                                    config: {
                                                        label: dataListTypes
                                                    }
                                                }
                                            ]
                                        }
                                    }
                                ]
                            }
                        }
                    ]
                }
            };
            views.push(currentView);
        }

    return views;
};

Outcomes