Felix Machus Felix Machus - 17 days ago 5
CSS Question

Implementation of the method .setStyleClass in detail View sapui5

Is there a possibility to adjust my table design with the method .setStyleClass?
And where and how do I implement this method ? Below a part of my detail view :

<columns>

<Column minScreenWidth="Tablet" demandPopin="true">
<Text text="{i18n>detailLineItemTableIDColumn}"/>
</Column>

<Column minScreenWidth="Tablet" demandPopin="true">
<Text text="{i18n>detailLineItemTableUnitNumberColumn}"/>

</Column>

<Column minScreenWidth="Tablet" demandPopin="true">
<Text text="{i18n>detailLineItemTableUoMColumn}"/>
</Column>


<Column minScreenWidth="Tablet" demandPopin="true">
<Text text="{i18n>detailLineItemTableDate}"/>
</Column>
sap.m.Column.setStyleClass
</columns>
<items>
<ColumnListItem>
<cells>

<ObjectAttribute
text="{Matnr}"
/>
<ObjectNumber
number="{path: 'Gesme' , formatter: '.formatter.numberUnit',formatOptions: {showMeasure: false}}" unit="{Meins}" state="Error"/>
<ObjectAttribute
text="{Lgpla}"/>
<ObjectAttribute
text="{path: 'Bdatu', formatter: '.formatter.formatDate'}"/>
</cells>
</ColumnListItem>


I want to adjust the font size of the column names. Feel free to suggest smarter ideas than mine.

Answer

you are using XML views and in order to add custom style sheets in XML view you don't need to use addStyleClass but just add class attribute to the element that you want to add style to.

Let's assume that you have a button you need to add style in the following way:

<Button class="myStyleClass"></Button>

and myStyleClass needs to be exist in your css file:

.myStyleClass {
  background-color: yellow;
}
Comments