How to set one "Label" widget per line in VerticalWidgets?

cancel
Showing results for 
Search instead for 
Did you mean: 
npavlov
Active Member II

How to set one "Label" widget per line in VerticalWidgets?

I want to have several lines of labels (alfresco/html/Label widget). But if I create such Aikau model, it doesn't work correct (see attached image – it works for Logo widgets, but all text is on one line):


model.jsonModel = {
    widgets: [
        {
            name: "alfresco/layout/VerticalWidgets",
            "config": {
                "widgetMarginTop": 10,
                "widgetMarginBottom": 10,
                "widgets": [
                    {
                        "name": "alfresco/logo/Logo"
                    },
                    {
                        "name": "alfresco/logo/Logo"
                    },
                    {
                        name: "alfresco/html/Label",
                        config: {
                            label: "text1 text2"
                        }
                    },
                    {
                        name: "alfresco/html/Label",
                        config: {
                            label: "text3 text4"
                        }
                    }
                ]
            }
        }
    ]
};
2 Replies
krutik_jayswal
Senior Member II

Re: How to set one "Label" widget per line in VerticalWidgets?

At first I was thinking that it is a bug in aikau, but may be not.I think labels are implemented for using it with the other widget as well.For example giving the label to the textfield.In this case this behaviour will be useful.

If you would like to print several values in a vertical way than i think you might use below widget.

JSDoc: Module: alfresco/lists/views/AlfListView 

npavlov
Active Member II

Re: How to set one "Label" widget per line in VerticalWidgets?

Hi, thanks a lot. I'm new in Aikau so I have a few more questions:

Do you think that we shouldn't use Label widget as ordinary widget at all? For example, i want to get a few lines of Labels how should I use AlfListView?

Such model doesn't work (I can't see anything on page):

{
    name: "alfresco/lists/views/AlfListView",
    config: {
        widgets: [
            {
                name: "alfresco/lists/views/layouts/Row",
                config: {
                    widgets: [
                        {
                            name: "alfresco/lists/views/layouts/Cell",
                            config: {
                                widgets: [
                                    {
                                        name: "alfresco/html/Label",
                                        config: {
                                            label: "text1 text2"
                                        }
                                    }
                                ]
                            }
                        }
                    ]
                }
            },
            {
                name: "alfresco/lists/views/layouts/Row",
                config: {
                    widgets: [
                        {
                            name: "alfresco/lists/views/layouts/Cell",
                            config: {
                                widgets: [
                                    {
                                        name: "alfresco/html/Label",
                                        config: {
                                            label: "text3 text4"
                                        }
                                    }
                                ]
                            }
                        }
                    ]
                }
            }
        ]
    }
}
How I should push my widgets into that list?

I found another widget:

JSDoc: Module: alfresco/lists/AlfList 

There are example for hard-coded data (but I don't know how to put my widget into value, if it is possible):

{
    name: "alfresco/lists/AlfList",
    config: {
        currentData: {
            items: [
                {value: "one"},
                {value: [
                    {
                        name: "alfresco/html/Label",
                        config: {
                            label: "text1 text2"
                        }
                    }
                ]
                },
                {value: "two"}
            ]
        },
        widgets: [
            {
                name: "alfresco/lists/views/HtmlListView",
                config: {
                    propertyToRender: "value"
                }
            }
        ]
    }
}

For that model i get:

one

[object Object]

two

on my page. Could we use insert our widget here?