Mortimer76
Mortimer76

Reputation: 1

Howto get OpenUI5 Binding Information

I need to figure out what objects within a OpenUi5 JSONModel are bound to at least one UI component.

I want to check what objects are bound of the model and then get only new values of the bound objects from an embedded device. With other words I do not want to get all available information of a embedded device via web request if some of them are currently not visible / bound on the Ui.

Does anybody have an idea how I could figure this out using javascript.

I already saw that the JSONModel has a property called aBindings that lists all current UiBindings, but I wonder if this is the right way to get that information.

Thanks!

Upvotes: 0

Views: 79

Answers (1)

Breakpoint
Breakpoint

Reputation: 1541

It looks like this is your first question here, so welcome to StackOverflow!

Although it is expected that you already try out the code for which you seem to have issues and then post it here with the errors or expected results, I will still try to help you out.

To get answers to your question, I would suggest you to read through the Data Binding section under Get Started: Setup and Tutorials of the SAPUI5 Demokit. This includes,

  • Creating a model
  • Property binding
  • Binding paths and formatting values

Once you get the basics right, you will see that with the concept of Two-way Binding, the model is already updated with the new values that you are looking for, if it's changed in the UI and vice-versa.

Also, if you are looking for a particular object or property, you can directly query the model instead of worrying about to which control it is binded.

For example this.getView().getModel("myModel").getProperty("/view/visible") will return the current value of the property "visible" regardless of which control it is binded to.

If my answer totally misses your question, please elaborate on your concerns and we can explore it further.

Upvotes: 1

Related Questions