Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Observe with deeply nested data

$
0
0
Building an app that has large JS data structures that reference each other. Want to be able to observe a deeply nested item in multiple controllers. The deeply nested item will be shared with multiple items, and live updates of current state should be "pushed" to everywhere it is referenced.
 
The example below shows "makes" reference by "cars" and "trucks", which are in turn referenced by "transports". The live list binding shows new items being added, but the deep state is not shown correctly.
 
The actual app is likely to have about a thousand top-level items in multiple views, which refer to shared "deep" state across hundreds of items.
 
Live binding appears to copy a snapshot of data into "_data", which seems unnecessarily expensive and results in updated deep state being ignored. 
 
Is there a good way to do this easily and efficiently? Our app could keep track of "dirty" objects and re-render them with a jQuery html() view helper -- though ideally we would re-render just the bit that changed. I am guessing/hoping there is an easier way.
 
Thanks, Glen
 
 

Viewing all articles
Browse latest Browse all 3491

Trending Articles