Julius Blitzy
Julius Blitzy

Reputation: 33

How to Change the Font Size of sap.m.Table in SAPUI5?

This is a very simple javascript question...but I am struggling, I tried to make the font bigger from this table, but I cannot get it to get the style from the sytle.css. Can anybody explain me why is it not working and the best way to achieve this task? I just started to learn... Thanks a lot!

STYLE.CSS

.bigLabel {
font-size: 36px;

}

View.XML

<mvc:View xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:cd="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1" controllerName="zTESTJK1.zTESTJK1.controller.Main" displayBlock="true">
<App id="idAppControl">
    <pages>
        <Page title="{i18n>title}">
            <content>
                <List id="list0" items="{/PESListSet}" headerText="List">
                    <items>
                        <StandardListItem type="Navigation" title="{FinishCode1}" description="{Matnr}" icon="sap-icon://picture" id="item0"/>
                    </items>
                </List>

                <Table id="table0" items="{/PESListSet}" headerText="Web Paint Booth " class="bigLabel">
                    <items>
                        <ColumnListItem type="Active" id="item0_1536935024975" >
                            <cells>
                                <Label text="{FinishCode1}" id="text0" class="bigLabel"/>
                                <Text text="{Hqty}" id="text1"/>
                                <Text text="           {           path: '/Htime/ms',           type: 'sap.ui.model.type.Time',           formatOptions: {           source : { pattern : 'timestamp' },           pattern: 'HH:mm:ss'          } }" id="text2"/>
                                <Text text="{Hpaint}" id="text3"/></cells>
                        </ColumnListItem>
                    </items>
                    <columns>
                        <Column id="column0">
                            <header>
                                <Label text="Finish" id="label0"/>
                            </header>
                        </Column>
                        <Column id="column1">
                            <header>
                                <Label text="Qty" id="label1"/>
                            </header>
                        </Column>
                        <Column id="column2">
                            <header>
                                <Label text="Time Hung" id="label2"/>
                            </header>
                        </Column>
                        <Column id="column3">
                            <header>
                                <Label text="Hand Paint" id="label3"/>
                            </header>
                        </Column>                           
                        </columns>
                        </Table>
            </content>
        </Page>
    </pages>
</App>

Upvotes: 0

Views: 6446

Answers (1)

n01dea
n01dea

Reputation: 1580

firstly, add !important in your style.css to overwrite the ui5 styles:

.bigLabel {
  font-size: 36px !important;
}

secondly, add directly to each control class="bigLabel". Each control that contains directly the text that is supposed to be displayed in the font-size of your bigLabel class:

<Table 
  id="table0" 
  items="{/PESListSet}" 
  headerText="Web Paint Booth">
  <items>
    <ColumnListItem 
      type="Active" 
      id="item0_1536935024975">
      <cells>
        <Label 
          text="{FinishCode1}" 
          id="text0" 
          class="bigLabel"/>
        <Text
          class="bigLabel" 
          text="{Hqty}" 
          id="text1"/>
        <Text 
          class="bigLabel"
          text="{           
          path: '/Htime/ms',           
          type: 'sap.ui.model.type.Time',           
          formatOptions: {           
            source: { 
              pattern: 'timestamp' 
            },           
            pattern: 'HH:mm:ss'          
          } 
        }" 
        id="text2"/>
        <Text 
          class="bigLabel"
          text="{Hpaint}" 
          id="text3"/>
      </cells>
    </ColumnListItem>
  </items>
  <columns>
    <Column 
      id="column0">
      <header>
        <Label 
          class="bigLabel"
          text="Finish" 
          id="label0"/>
      </header>
    </Column>
    <Column 
      id="column1">
      <header>
        <Label 
          class="bigLabel"
          text="Qty" 
          id="label1"/>
      </header>
    </Column>
    <Column 
      id="column2">
      <header>
        <Label 
          class="bigLabel"
          text="Time Hung" 
          id="label2"/>
      </header>
    </Column>
    <Column 
      id="column3">
      <header>
        <Label 
          class="bigLabel"
          text="Hand Paint" 
          id="label3"/>
      </header>
    </Column>                           
  </columns>
</Table>

Upvotes: 1

Related Questions