Change column width in sap.m.Table
I have a lot of rows in sap.m.table and I want to display all row names correctly. First I made the table auto and gave the columns 100% width and made them require popin. I tried many combinations, but I was unable to show them correctly. That's what I have at the end.
My opinion is as follows:
<m:ScrollContainer
height="100%"
width="100%"
horizontal="true"
vertical="true"
focusable="true">
<m:Table id="idTable"
inset="false"
growing="true"
growingThreshold="3"
fixedLayout="false"
visibleRowCount="7"
border-collapse="collapse"
items="{
path: '/...',
sorter: {
path: '...'
}
}">
<m:headerToolbar>
</m:headerToolbar>
<m:columns>
<m:Column
minScreenWidth="Desktop"
demandPopin="true"
width="12em">
<m:Text text="{i18n>YUKLEME_NO}" />
</m:Column>
<m:Column
minScreenWidth="Desktop"
demandPopin="true"
hAlign="Left">
<m:Text text="{i18n>GEMI_BILGISI}" />
</m:Column>
<m:Column
minScreenWidth="Desktop"
demandPopin="true"
width="12em"
hAlign="Left">
<m:Text text="{i18n>YUKLEME_ARAC_SAYISI}" />
</m:Column>
<m:Column
minScreenWidth="Desktop"
demandPopin="true"
hAlign="Left">
<m:Text text="{i18n>PROFORMA_NO}" />
</m:Column>
...
<m:Column
demandPopin="true"
width="14em"
hAlign="Left">
<m:Text text="{i18n>MODEL}" />
I've also tried using minScreenWidth = "Desktop" and wrapping = "true" for the columns. Yet that hasn't changed.
Thanks for the help.
source to share
If you are not thinking about going for this particular scenario, I would suggest you go for sap.ui.table.Table .
Sample code:
oTable = new sap.ui.table.Table({
title: "Table with fixed columns Example and scroller",
visibleRowCount: 7,
firstVisibleRow: 3,
selectionMode: sap.ui.table.SelectionMode.Single,
navigationMode: sap.ui.table.NavigationMode.Paginator,
fixedColumnCount: 0
});
source to share
See sap.m.Column.minScreenWidth as well as Enum sap.m.ScreenSize .
You are using minScreenWidth = "Desktop" for all of your columns. This means the columns will look as you see until the screen width is less than 1024 pixels. You can play with different combinations of sap.m.ScreenSize for your columns. But you can also use something like minScreenWidth = "1280px" instead of using an enumeration. Alternatively, you can use width = "9em" or whatever the value is. So basically the problem you described occurs if you have bad configuration for the minScreenWidth column properties.
source to share