Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My computed's set function return value isn't getting merged into the model when triggered from the ui #126

Open
OneGeek opened this issue Jul 10, 2015 · 3 comments

Comments

@OneGeek
Copy link

OneGeek commented Jul 10, 2015

I have a view with a computed property that defines a set function which returns an object with some properties set. I've bound this to an <input> with the declaration value:myComputed.

The documentation of computeds describes that the return value of a computed's set is merged into the model when called.

I've confirmed the following
  • Modifying properties the computed depends on updates the <input>
  • Calling view.model.set('myComputed', '...') also updates the <input>
  • The computed's set does get called when I modify the <input>
What I expect to work, but doesn't
  • Modifying the <input> does not update the model
  • Calling view.setBinding('myComputed', '...') does not update the model

Looking at the source code I see the value I return from set gets as far as being returned from a call to accessor(self.get(self.$el, readAccessor(accessor), evt)) in the definition of EpoxyBinding, but nothing is done with it at that point.

My question

Am I misunderstanding the documentation here or is this a bug?

@docmattman
Copy link

I'm having the same issue. Have you found a solution?

@OneGeek
Copy link
Author

OneGeek commented Jan 15, 2016

I do not believe I managed to make this happen.

@jekuno
Copy link

jekuno commented May 20, 2016

This works for me. Did you bind your computed correctly to an event e.g.
'input#my-computed': "value:myComputed, events:['input']"

Did you check that the attributes you return in the set function belong to a model defined in bindingSources (e.g. the model associated to the view)? Also ensure that in the set of myComputed you do not try to set this attribute directly (which would result in a recursive set call).

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

No branches or pull requests

3 participants