Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use layout.Grid in XML view SAPUI5?

Tags:

sapui5

I have that code. (https://openui5.hana.ondemand.com/#test-resources/sap/ui/layout/demokit/Grid.html)

var oGrid1 = new sap.ui.layout.Grid({
    hSpacing: 1,
    vSpacing: 1,    
    content: [
        new sap.ui.commons.TextView({
            text : 'Text spanned over 4 cols on large, 6 cols on medium, and 12 cols on small screens.',
            layoutData : new sap.ui.layout.GridData({
                span : "L4 M6 S12"
            })
        }),
        new sap.ui.commons.TextView({
            text : 'Text spanned over 4 cols on large, 6 cols on medium, and 12 cols on small screens.',
            layoutData : new sap.ui.layout.GridData({
                span : "L4 M6 S12"
            })
        }),
        new sap.ui.commons.TextView({
            text : 'Text spanned over 4 cols on large, 6 cols on medium, and 12 cols on small screens.',
            layoutData : new sap.ui.layout.GridData({
                span : "L4 M6 S12"
            })
        })
    ]
});


oGrid1.placeAt("sample1");

And I can't understand how to use following thing in XML notation.

layoutData : new sap.ui.layout.GridData({span : "L4 M6 S12"})
like image 334
neformal Avatar asked May 22 '14 13:05

neformal


1 Answers

SAPUI5 Diagnostics CTRL+ALT+SHIFT+S ->XML View Conversion - a utility that allows you to convert an existing view to XML or HTML view markup

<sap.ui.commons:TextView text="Text spanned over 4 cols on large, 6 cols on medium, and 12 cols on small screens.">
    <sap.ui.commons:layoutData>
        <sap.ui.layout:GridData span="L4 M6 S12" spanL="0" spanM="0" spanS="0" indentL="0" indentM="0" indentS="0" spanLarge="0" spanMedium="0" spanSmall="0" indentLarge="0" indentMedium="0" indentSmall="0"></sap.ui.layout:GridData>
    </sap.ui.commons:layoutData>
</sap.ui.commons:TextView>
like image 127
Jasper_07 Avatar answered Dec 05 '22 22:12

Jasper_07