update
can.Control.plugin.prototype.update
Reconfigure a control.
update(newOptions)
Parameters
-
newOptions
{Object}
Options to merge into the current options.
-
options
{Object}
A list of options to merge with this.options. Often this method is called by the jQuery helper function.
Update extends options with the
options
argument and rebinds all events. It re-configures the control.For example, the following control wraps a recipe form. When the form is submitted, it creates the recipe on the server. When the recipe is
created
, it resets the form with a new instance.Update is called if a control's plugin helper is called with the plugin options on an element that already has a control instance of the same type. If you want to implement your own update method make sure to call the old one either using the super plugin or by calling
can.Control.prototype.update.apply(this, arguments);
. For example, you can change the content of the control element every time the options change: