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

valueAccessor() fails to set values #2

Open
mryellow opened this issue Jul 25, 2014 · 1 comment
Open

valueAccessor() fails to set values #2

mryellow opened this issue Jul 25, 2014 · 1 comment

Comments

@mryellow
Copy link
Owner

One-way binding seems fine but when we try to set values in the parent apps bound model they trigger update, this then fails as the refreshAll() function isn't on this valueAccessor().

Using the arrays the way I have is really the wrong way to use KnockoutJS.

The CSV remains an issue unless it's handed off to the client end to process, tokens haven't actually saved the id and other fields that were returned from AJAX as suspected, only value and label is available after the initial token creation.

Working on a solution that can pass everything straight through to the bound valueAccessor() while still dealing with flat CSV style return into non-array observables.

@mryellow
Copy link
Owner Author

Making specific updates in a custom binding

When creating a custom binding, typically the update function is used to track any dependencies that should trigger the function to be called again. Usually this is to respond to view model changes and make corresponding updates to the user interface. Internally, Knockout actually uses a computed as the mechanism to track these dependencies. In some cases, you may need more control over what triggers an update and the exact code that is executed to respond to an update. Perhaps you have multiple observable options, and want to perform different updates to the bound element when either change. In this scenario, in the init function, you can create one or more computeds to handle changes specific to each option.

https://blog.safaribooksonline.com/2014/02/19/getting-knockout-js-computed-observables/

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

1 participant