Skip to Content
0

SapUI5 Grid Table Column Auto Width Issue

Jan 18 at 06:09 AM

40

avatar image
Former Member

Hello Developers,

I'm using sap.ui.table component and I would like to set the column width value "auto" depending on cell content value's width. But I couldn't do that. How can I set auto width columns ?

Here is a part of my code and screenshot;

for (var i = 0; i < json.length; i++) {
            oTable.addColumn(new sap.ui.table.Column({
                label: new sap.m.Label({
                    text: json[i].Value,
                }),
                template: new sap.m.Text({
                    text: '{' + json[i].Key + '}',
                    wrapping : false,
                    textAlign : sap.ui.core.TextAlign.Begin,
                }),
                sortProperty: json[i].Key,
                filterProperty: json[i].Key,
                width : 'auto',
                resizable : false,
                flexible : false,
                //enableGrouping : json[i].enableGrouping,
                //visible : json[i].visible,
            }));
            oTable.autoResizeColumn(i);})

Here is the result image;

Image Url

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers