All docs
V19.1
24.1
The page you are viewing does not exist in version 24.1.
23.2
The page you are viewing does not exist in version 23.2.
23.1
The page you are viewing does not exist in version 23.1.
22.2
The page you are viewing does not exist in version 22.2.
22.1
21.2
21.1
20.2
20.1
19.2
19.1
18.2
18.1
17.2
The page you are viewing does not exist in version 17.2.
A newer version of this page is available. Switch to the current version.

DevExtreme jQuery - Get a Widget Instance

IMPORTANT
According to Stack Overflow Trends, MVVM frameworks such as Angular, Vue, and React became more popular than Knockout in recent years. DevExtreme will continue to support Knockout but we recommend that you use one of these frameworks in your new projects.

To get a widget instance, save it in a view model property once the widget is initialized:

JavaScript
var viewModel = {
    menuInstance: {},
    menuOptions: {
        // ...
        onInitialized: function (e) {
            viewModel.menuInstance = e.component;    
        }
    }
};

ko.applyBindings(viewModel);

Alternatively, you can apply techniques from the jQuery article.

See Also