0

I have a working solution with odata model v1 to display a Edm.Time in my xml view.

Now I am upgrading my model to version 2. Here now comes the problem. The same coding in XML view with the new model don“t show any data.

XML-View:

{ 
  path:'modelV2>LastCommTime',  
  type: 'sap.ui.model.type.Time',
  formatOptions: {  
    source : {  pattern : '\'PT\'hh\'H\'mm\'M\'ss\'S\'' }, 
    pattern : 'HH:mm:ss'
  }
}

This code shows nothing.

If I delete the line type: 'sap.ui.model.type.Time', it displays [object Object]

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
alexander-fire
  • 1,082
  • 4
  • 27
  • 52

1 Answers1

4

The ODataModel v2 deserializes the Edm.Time in a internal representation. Thats the [object Object] you are seeing.

To format it you can use the sap.ui.model.odata.type.Time type. A source.pattern is not needed in that case:

{ 
  path:'modelV2>LastCommTime',  
  type: 'sap.ui.model.odata.type.Time',
  formatOptions: {  
    pattern : 'HH:mm:ss'
  }
}
schnoedel
  • 3,918
  • 1
  • 13
  • 17