Show TOC

Handling Events in JSON ViewsLocate this document in the navigation structure

In JSON views, event handlers are bound as attributes with the attribute name as event name like "press" for a button and the attribute value as event handler name.

Prerequisites

For the location in which an event handler is looked up, see Handling Events in XML Views.

Procedure

The following declaration causes controller.doSomething() to be executed when the button is pressed:
...
   {
      "Type":"sap.ui.commons.Button",
      "id":"MyButton",
      "text":"Press Me",
      "press":"doSomething"
   }
...