Openui5: [smart-table] Columns of sap.ui.table.Table smart table do not get automatically resize

Created on 1 Nov 2017  路  5Comments  路  Source: SAP/openui5

OpenUI5 version: 1.44

Browser/version (+device/version): Chrome 62

Steps to reproduce the problem:

  1. Create a Smart table with table type is sap.ui.table.Table
  2. Integrate data from Backend
  3. The columns width of the table is set to "30em" by default; which is too large for many columns.

What is the expected result?
The columns should be automatically resized based on the content of that column, which is done in sap.m.table.

What happens instead?
The columns' width set is too big.

Solution:
For now, I have a temporary solution is:

  • loop through all columns.
  • use "autoResizeColumn", or set width of column to "100%".

If seem to work for now. But I think the smart table property should have a property call "autoResizing" so that we don't have to add this code every time we use a smart table.

What do you think about that?
Looking for your comment.

Thank you,
Victor.

p/s: sorry I couldn't upload an example image because of restriction of my company network.

author action

Most helpful comment

Hi There,

I Share temporary solution,

image

at js file .

    onDataReceived: function() {
        var oTable = this.byId("LineItemsSmartTable");
        var i = 0;
        oTable.getTable().getColumns().forEach(function(oLine) {
                            oLine.setWidth("100%");
            oLine.getParent().autoResizeColumn(i);
            i++;
        });
    }

All 5 comments

Hello @strawherotk ,
Please provide a reproducible example by adapting this jsbin.
Kind regards,
Diana

Since there is no response from the author for more than 4 weeks I'm closing the ticket.

hello @Shtilianova

@strawherotk say about this situation

before
image

When i was double click columm seperator line automaticly resize. We are need to auto optimization atribute for smarttable.

image

hello @Shtilianova

@strawherotk say about this situation

before
image

When i was double click columm seperator line automaticly resize. We are need to auto optimization atribute for smarttable.

image

Hi @mustafaonder,
Thanks for explaining my suggestion using images.
It's what I mean.
(I couldn't attach the images when I open this ticket).

Hi @Shtilianova ,
I missed your request for comment.
@mustafaonder has clearly explained my suggestion so I think I don't need to explain again.
Let me know if you want to know more details.

Thank you.
Victor

Hi There,

I Share temporary solution,

image

at js file .

    onDataReceived: function() {
        var oTable = this.byId("LineItemsSmartTable");
        var i = 0;
        oTable.getTable().getColumns().forEach(function(oLine) {
                            oLine.setWidth("100%");
            oLine.getParent().autoResizeColumn(i);
            i++;
        });
    }
Was this page helpful?
0 / 5 - 0 ratings