on 12-08-2016 10:48 AM
Hi,
I haven't asked a question here in like 5 years or so. So that means I'm really stuck...
In my SAPUI5 application, I cant to change the rotation of an icon depending on the value in the model. So I'm using a custom formatter, which takes in the model value. The custom formatter is in a separate formatter.js file. It's referenced in the view controller and it's being called correctly.
BUT! According to an old thread on StackOverflow, the "this"-reference should point to my uiElement. Which would be great, because that's exactly what I need to alter the rotation of the element. (thread: how-to-pass-control-reference-to-formatter-in-xmlview )
(there isn't a rotation property on an sap.ui.core.Icon, so please don't tell me that it's a bad idea to manipulate the uiControl from inside the formatter... )
Except that "this" apparently references my view controller, instead of my UI Element.
Watskebeurt?
Please advise.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you didn't follow it correctly
just use the full name(path) of the formatter, don't put it in your controller
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I had actually already tried that, but that didn't work either.
Than my formatter was simply not recognized/found by the framework. (mind you, the path was quite definitely correct)
I've also tried inline binding (.bind(this) ) but that didn't go well either.
I've also tried to refactor my formatter to the old notation style AND call it via either full path specification or via controller mapping, but the former failed (again, framework couldn't find the formatter), and the latter still had the controller as self reference.
I'm not sure what the difference is between 1.40 and 1.34 that changed this behaviour.
Anyway, I got around it. Back to battle.
It doesn't,
the latest libraries 1.40+ should have changed this behaviour;
and this is quite a big issue of the framework; i need to change the color of some input texts based on the text itself, and those input fields are column elements of a table, so they do not have preassigned Ids
the easy way would be a formatter function that add or remove some css class to the input control itself.
oh!
and also every change / livechange event is triggered only if the change is performed by the user, so from the view to the model; but if the model is updated by a webservice or by calculation and the model propagates the update to the view than no change event is triggered.
So my question is:
Do you have any solution to perform actions on a control based on dynamic changes of a property of the control itself??
User | Count |
---|---|
92 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.