Hi all - I'm wondering if anyone knows of any good examples I can learn from before I attempt to build the following myself:
I'm building a single-page app using controls from another framework, because I need the rich interactive controls. I'm using Dojo to build the prototype right now although I could imagine switching to Sencha or similar because I really dislike the rest of Dojo. Anyway, I've already built an adapter from that framework to CanJS views, ie. a View control which renders a mustache template that stays up to date as the underlying data changes. That's simple enough but not sufficient because I can't constantly re-render entire areas, I need to do incremental updates that can't be expressed in a Mustache template.
Now I'd like to build a controller that affects the properties of multiple framework controls [ie not DOM nodes, but stuff hanging off them.] For example, if I instantiate a "Menu" control (comprising Menu, sub-Menu, MenuItem, etc controls), then I'd like to have a CanJS model (control?) driving the options for that control. End result is that I can say something like
menu1.attr('submenu1').attr('label', 'Label 1');
menu1.attr('submenu2').attr('disabled', true);
menu1.addMenu({ ... submenu 3 definition ...});
etc.
in CanJS code & my adapter will take care of calling the appropriate functions in the other framework to create,update,destroy various menu items.
The long-term goal is to use CanJS as the interface for a server that pushes updates to the client UI. Rather than writing individual lines of code as above, I would be doing
menu1.attr(new_menu_definition);
and relying on CanJS to parcel out a set of diffs which my adapter uses for updates. Not like I'll be constantly changing UIs, but since each client's UI is driven by a set of permissions, this would give me a good interface builder + the ability to update the client on the fly when permissions change. UI could also change based on data from other controls, ie. a checkbox here makes a menu item appear or disappear there.
Anyone seen or written something similar, where CanJS is used to drive external controls? Thanks!