Skip to Content
0
Nov 20, 2018 at 12:17 AM

sap.ui.Table Binding a value to column titles

272 Views

I am trying to bind a value to a column titles in XML view similar to binding data to actual data cells as following (this works):

<Column width="7em" 
   sortProperty="col1"
   filterProperty="col1">
   <m:Label text="Year" />
      <template>
         <m:Text text="{col1}"/>
      </template>
</Column>

(This does not work)--> If I try to bind data to column title, only first string literal "Year" shows up, but not the data in binding expression:

<Column width="7em" 
   sortProperty="col1"
   filterProperty="col1">
   <m:Label text="Year {=${year}}"/>
      <template>
         <m:Text text="{col1}"/>
      </template>
</Column>

The goal is to have a concatenated string such as: "Year" + currentYear as a column title. The only way (from what I understand) to have currentYear in XML view is to bind it through expression binding. Is there any ideas how to overcome this issue? Thank you!