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

observable event handle not binding correctly to DOM #129

Closed
thaapaniemi opened this issue Jan 18, 2016 · 4 comments
Closed

observable event handle not binding correctly to DOM #129

thaapaniemi opened this issue Jan 18, 2016 · 4 comments

Comments

@thaapaniemi
Copy link

At least click events don't bind after changing view if observable is changed in code with App.View('ViewX').value(newVal); (this.value(newValue) works).

Example: https://github.com/thaapaniemi/jsblocks_i1

What is the "right" way to update the observable from locations where this doesn't point to the current View object?

@Kanaye
Copy link
Collaborator

Kanaye commented Jan 18, 2016

Hey @thaapaniemi,

You can access properties of a view like so: App.ViewX.myObservable().

But keep in mind that this will only work after the application finished initializing.

Have a nice day!

@Kanaye
Copy link
Collaborator

Kanaye commented Jan 18, 2016

Whoops sorry,
I was on my mobile while answering this and didn't read your example, so just ignore my previews comment as it's not the solution.

It seems that this is a bug because your way is a "right" way.

After taking a first look at your example I think this could be an issue with the views context or the order of execution in this scenerio.
But that is just a first guess.
I will dive into that deeper tomorrow as I have unfortunally no time to spent yet.

I will post here when I'm making progress.

@Kanaye
Copy link
Collaborator

Kanaye commented Jan 20, 2016

Hey @thaapaniemi,
thank you for reporting this issue.
We had a serious problem with the views context getting overwritten in some cases.
I fixed it in #130 so your code will work in the next release.

For now you can modify this line to use $root.FirstView.click instead of $view.click.

astoilkov referenced this issue Jan 20, 2016
Now cloning __props__ and changed order in 'with'
@thaapaniemi
Copy link
Author

Thank you for fast response. The quick fix works great with current code for now.

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

2 participants