cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

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

0 Likes
View Entire Topic
Former Member
0 Likes
MioYasutake
SAP Champion
SAP Champion
0 Likes

Hi navneet_nair,

Thanks for your suggestion.

I tried the solution, but BusyStateChanged event was too early to adjust columns.

The columns were adjusted to match the width of the title rather rather than the width of the contents.

I used sap.ui.table.Table in a freestyle app (not list report), which may caused the difference.

Thanks,

Mio