Calling method from options function of jquery widget -
Calling method from options function of jquery widget -
iam creating widget , need method in options (with possibility of calling _somemethod in same widget):
options: { afterload: function (count) { this._somemethod(); } } _somemethod: function(){ }
but "this" in options have context of options. how phone call _somemethod() options method afterload? how widget context on afterload method?
thanks answer.
you need define function ( method
) variable , utilize later in object :
var somemethod = function() { ... }; options: { afterload: function (count) { somemethod(); } } _somemethod: somemethod
by doing assign variable must define within function ( because don't want leak global variables ) , utilize reference in options
jquery jquery-ui
Comments
Post a Comment