cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Resizing smart table standard fields

haemma83
Active Participant
0 Likes
470

Hello,

I got a smart table without a variant. And I want to resize the standard fields which come over annotations. I manage the resizing with my own custom fields. But not with the standard ones.

I tried this in the controller - but it doesn't work:

	oTable.getColumns().forEach(function (oColumn) {
				if (oColumn.sId.includes("Matnr") || oColumn.sId.includes("Aufnr")) {
					oColumn.setWidth("30%");
					//oTable.autoResizeColumn(oColumn.getIndex());
				}
			
			});

I tried this at the afterRendering function and in the data-received Event of the table..

Simply doesn't work at all.

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

haemma83
Active Participant
0 Likes

Thanks Thorsten. But the question is not the call but why the setWidth() isn't working and what I can do about it..

haemma83
Active Participant
0 Likes

The solution is - you can only use the

oTable.autoResizeColumn(oColumn.getIndex());

method. setWidth() does not work...

Answers (1)

Answers (1)

ThorstenHoefer
Active Contributor
0 Likes

Hi,

you can get the used table (e.g. sap.m.Table) with

_oSmartTable.getTable().

sap.m.Table has the event updateFinished. Try to modify the columns here.

Sample Code

<smartTable:SmartTable tableType="ResponsiveTable" >
  <m:Table updateFinished=".doModifyColumn">
  </m:Table>
</smartTable:SmartTable>

doModifyColumn: function(oEvent){
var oTable = oEvent.getSource();
oTable.getColumns().forEach(function (oColumn) {
  f (oColumn.sId.includes("Matnr") || oColumn.sId.includes("Aufnr")) {
					oColumn.setWidth("30%");
					//oTable.autoResizeColumn(oColumn.getIndex());
				}
			
			});
			
}