hi i have a model in knockout holded by a variable :
var knockoutObject = knockoutObservable;
if i do this:
knockoutObject(newValue);
it triggers the binding events for knockout(?) and the ui is refreshed
how can i update the value of the knockoutObservable without affecting the entire screen? in other words: updating the value on the model but not updating the UI
I know its kind of weird because that’s the deal with MVVM but i need it for a specific scenario…
edit:
what im trying to do:
I have a few jsTrees on the screen. they are bounded to the model.
when I update a certain observable in the model all the trees are being re rendered and are closed to there default state. it gives me a bad user experience
so because the UI is already updated with the correct values when i chane a value in a tree (this is how i built it) i dont need knockout to rerender the trees. just the value on the model.
i have a custom binding handler for the trees:
ko.bindingHandlers.Tree
thanks
You can use throttle to delay execution – but you probably want to approach the entire problem differently. With some more insight into what you’re trying to solve, we can probably suggest a better alternative.
UPDATE (from comments):
The binding ideally should not recreate the jsTree plugin, but simply modify it’s internals. This is the preferred way of doing it.
If you can’t do that, see if you can cache the state in the binding and recreate the jsTree with previous state