Skip to Content

Adding type information in XML views

With JS views it is possible to add type information to a field, for example:

oControl = new sap.ui.commons.TextField({
     value: {
          path:"/company/revenue",
          type: new sap.ui.model.type.Float({
               minFractionDigits: 2,
               maxFractionDigits: 2
          })
     }
})

See https://sapui5.netweaver.ondemand.com/sdk/#docs/guide/BindingProperties.html

I've tried the same with XML views (according to https://sapui5.hana.ondemand.com/sdk/test-resources/sap/m/demokit/explored/index.html#/code/inputChecked ) without success


Please check my gist example: Binding problems with UI5 and XML views


Am I doing something wrong?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2014 at 07:55 PM

    Hi,

    No, you are doing fine!

    The thing that is missing is what the documentation forgets to say.

    <script src="resources_path/sap-ui-core.js" id="sap-ui-bootstrap"

    data-sap-ui-libs="sap.m"

    data-sap-ui-theme="sap_bluecrystal"

    data-sap-ui-xx-bindingSyntax="complex">

    </script>

    There is needed to tell the core that you are using a complex binding syntax. I don't know why that is not a default option, but that is the way it is.

    Regards,

    Luis Alberto

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 09, 2014 at 07:27 AM

    Hi Uwe

    Luis is spot on. I had thought you already had that (thought you might have seen my Twitter conversation with Tom Van Doorslaer yesterday :-)

    Nice work on putting the Gist together, btw - was perfect - I had your test app code downloaded and running in my browser in 30 seconds. I had to make a couple of tweaks, perhaps I should write a post on what I did.

    For info, the config options are documented in the Developer Guide section of the SDK.

    cheers!
    dj

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 09, 2014 at 04:21 PM

    Reporting back as promised: it works 😀

    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.