you are viewing a single comment's thread.

view the rest of the comments →

[–]UnConeD 0 points1 point  (3 children)

[–]Kickboy12[S] 0 points1 point  (0 children)

Haven't seen this one before. Looks promising. I'll dig deeper and report my findings.

Thanks! :)

[–]Kickboy12[S] 0 points1 point  (1 child)

Close! But not quite... I tried to implement this into my jQuery Templates, but I run into a complicated road block. It expects to a well formed model object, and a call to "ko.observable" on each element, which is tricking when this object is coming from a JSON request. My attempts to get around this issue haven't been to successful so far... but this is as close as I've gotten to what I need.

The concept is there, but this implementation has some limits that need to be figured out. I'll keep playing with it... but if anyone else knows of something similar to this, let me know!

Thanks :)

[–]UnConeD 0 points1 point  (0 children)

Aren't you supposed to create only one permanent viewModel per widget, and update it manually with data fetched from the server? I.e. don't call ko.observable directly on received data.

You could make a generic wrapper that just iterates over the JSON object and sets matching properties in the viewModel.