Showing results for 
Search instead for 
Did you mean: 

SapUI5 Grid Table Column Auto Width Issue

Former Member
0 Kudos

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,

Here is the result image;

Image Url

Accepted Solutions (0)

Answers (0)