Help us shape the 2021 DevExtreme Roadmap. Take our 5 minute survey.
Dismiss

Handle Events

You can subscribe to an event using a configuration property. All event handling properties are given names that begin with on.

JavaScript
var viewModel = {
    menuInstance: {},
    menuOptions: {
        // ...
        onItemClick: function (info) {
            // Handles the "itemClick" event
        },
        onInitialized: function (info) {
            // Saves the UI component instance
            viewModel.menuInstance = info.component;    
            // Handles the "initialized" event
        }
    }
};

ko.applyBindings(viewModel);

View Demo

See Also
  • API Reference.WidgetName.Events, for example, API Reference.Menu.Events