Skip to content Skip to sidebar Skip to footer

Is There A Better Alternative To Sap.ui.commons.layout.matrixlayout?

What's the best way to do a layout where the start content is fixed, the center is flex and the end content is fixed? Like a 100% wide HBox with three columns, first and last col a

Solution 1:

The HBox is the solution for browsers supporting the CSS3 FlexBoxLayout. Alternatively, you could nest two FixFlex layouts - this should work in all UI5-supported browsers (FixFlex is like a specific, limited subset of HBox/Vbox with fallback for non-FlexBox browsers).

Solution 2:

Ok, I think I got it. :)

new sap.m.HBox({
    items: [
        new sap.m.Label({
            text: 'start', 
            width: '100px',
            layoutData: new sap.m.FlexItemData({
                growFactor: 0
            })
        }),
        new sap.m.Label({
            text: 'center',
            layoutData: new sap.m.FlexItemData({
                growFactor: 1
            })
        }),
        new sap.m.Label({
            text: 'end', 
            width: '100px',
            layoutData: new sap.m.FlexItemData({
                growFactor: 0
            })
        })
    ]
})

Post a Comment for "Is There A Better Alternative To Sap.ui.commons.layout.matrixlayout?"