Skip to Content
author's profile photo Former Member
Former Member

Format numbers in UI5 table column

Hi Community,

I have an UI5 table with oData binding to a HANA CalcView and wonder what is the best way to format numbers in US style (, as thousand separator).

Is it possible to configure the table column for this purpose or rather within the oData service definition?

Thank you,
Fabian

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 04, 2013 at 09:52 AM

    You can do this when binding the property.

    Here's a example to demonstrate the concept:

    var tvTest = new sap.ui.commons.TextField().bindProperty("value","COLOR", function(cellValue) {     // do formatting here...      return cellValue;});

    You'll find more information in the docs... 😉

    greets,

    Ben

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 04, 2013 at 02:14 PM
    -1

    You can also just specify a type when specifying the binding to the property in the template like this:

              new sap.ui.table.Column({              label: new sap.ui.commons.Label({text: "Numbers"}),              template: new sap.ui.commons.TextView().bindProperty("text", {              path: "value",              type: new sap.ui.model.type.Float          // <--- specify type here             })          })

    By default, the builtin Float type has comma separators. You can also specify your own type if you want to be more exotic, I've put an example here:

    http://jsbin.com/eXeBOcE/3/edit?html,output

    dj

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.