I've been working on javascript codebase that stores all its data in forms, hiding and showing all the form elements as the view changes. This has worked well while the structure of the data was relatively rigid. But now we've got dynamically structured (tree-like) data we need to be able to grow and shrink the views in more flexible ways.
While I'm not a gung-ho MVC advocate, it certainly looked like the app could do with a bit of an MVC style cleanup (the data was in the view rather than being accessed by the view).
The problem was it wasn't clear how to get the data out of the view... here's a simplified version of the method I'm planning to use.
You can also play with this using jsfiddle
I'm thinking about implementing broadcasting of changes and more model based approach later... but maybe that'll have to be another post.
Thursday, June 2, 2011
Creating data bindings using javascript closures
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment