Search code examples
sapui5

What Does `getObject` from Binding Context Return?


I created the following example: jsbin.com/tigamol/.

The oEvent.getParameter("selectedItem") returns the property from the Input control.
What does oEvent.getParameter("selectedItem").getBindingContext().getObject() statement return?


Solution

  • See sap.ui.model.Context getObject:

    Gets the (model dependent) object the context points to

    The JSONModel has been bound to the suggestionItems aggregation of the Input.
    Each suggestionItem has its context which points to the corresponding object in the JSONModel.

    It selects the suggestionItem from the oControlEvent. Gets the context of the suggestionItem then gets the object from the context.