Skip to content
This repository has been archived by the owner on Jan 6, 2019. It is now read-only.

Executing methods with parameters #1

Open
nix4 opened this issue Dec 1, 2014 · 2 comments
Open

Executing methods with parameters #1

nix4 opened this issue Dec 1, 2014 · 2 comments

Comments

@nix4
Copy link

nix4 commented Dec 1, 2014

JQuery widgets allows you to execute methods on the instance and pass parameters to those methods for example:
$( "#elem" ).progressbar( "value", 40 ); will execute the 'value' and pass the 40 to the function.

How can I achieve the same with backbone.widget?

I noticed on:

return instance[options].call(klass);

that the method being executed on the widget is invoked but where are the parameters passed?

Is this not supported in backbone.widget?

Thanks

@meleyal
Copy link
Owner

meleyal commented Dec 2, 2014

No, passing arguments is not currently supported. This should be pretty easy to add though if you'd consider making a pull request?

@nix4
Copy link
Author

nix4 commented Dec 2, 2014

I think we may not need this feature since there is a way of getting the widget instance. This is how I have I implemented what I needed:

var wgtInstance = $( "#elem" ).data( "progressbar" );
if(wgtInstance){
     wgtInstance.value(40);
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants