on 2014 Jan 08 7:04 PM
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/inputChe... ) without success
Please check my gist example: Binding problems with UI5 and XML views
Am I doing something wrong?
Request clarification before answering.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Reporting back as promised: it works
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi DJ,
yes, I've seen the discussion on Twitter, but haven't realized that this is relevant for me (bummer).
Will try the solution tonight and report back.
But as Luis already said, this should be default, else JS and XML views behave different. Or are there problems with performance and/or memory consumption if I'm using this config?
The documentation says:
Note: This functionality is marked as experimental and can be switched on via the configuration flag xx-bindingSyntax=„complex“. The reason is that it is not fully compatible with existing syntax because now you have to escape curly braces {}. Without escaping it is interpreted as extended calculated fields syntax
(yes, there are unicode problems on the site )
Is there an official statement from SAP whether we can/should use this functionality?
Uwe
I've not seen an official statement. But in any case, for me it's the default, and I even supply it as default in the SublimeUI5 Templates and Snippets, for example:
and
SublimeUI5/Snippets/indexm.html.sublime-snippet at master · qmacro/SublimeUI5 · GitHub
dj
User | Count |
---|---|
64 | |
8 | |
7 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.