Call Methods

To call a widget method, you can apply techniques described in the Call Methods topic for jQuery.

As an alternative, you can save the widget instance 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);

... and call any method of the saved instance afterwards.

JavaScript
viewModel.menuInstance.repaint();
See Also