on 2020 Jun 17 1:45 AM
Hello.
I want to adjust the width of the column to match the width of the content, using sap.ui.table.Table.
The controller code is as follows.
onInit: function () {
var oTable = this.byId("table");
oTable.bindRows({
path: '/BusinessPartnerSet',
events: {
dataReceived: this._adjustColumn.bind(this)
}
});
},
_adjustColumn: function () {
var oTable = this.byId("table");
oTable.getColumns().forEach((oColumn, index) => {
oTable.autoResizeColumn(index);
});
}
The issue is, at the point of dataRecieved event, contents in the table are not yet available.
As a result, the columns are adjusted to match the width of the title, wihch is sometimes too small to fit all the content in.

Does anybody know which event we can use to adjust columns?
Best regards,
Mio
Request clarification before answering.
Hi
Try this code as well - in the event after rendering.
var oTe = new sap.ui.table.TablePointerExtension(oTable);
var aColumns = oTable.getColumns();
for (var i = 0; i < aColumns.length; i++) {
oTe.doAutoResizeColumn(i);
}
Regards,
Venkat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.