Opened 12 years ago

Closed 6 years ago

#11367 closed enhancement (invalid)

Demo of using dojo.Stateful API for MVC patterns and property-driven programming style

Reported by: cwiecha Owned by: cwiecha
Priority: high Milestone: 1.13
Component: Demos Version: 1.5.0rc1
Keywords: Demo Cc: [email protected]…, [email protected]
Blocked By: Blocking:


As discussed in dojo team meeting 6/23/2010, here's a demo showing the use of the new dojo.Stateful APIs in 1.5 as applied to an image resize dialog. The demo is packaged according to Dustin's template at and has been checked into github as well at

Adding here as requested IIRC...Thanks, Charlie Wiecha

from the package README:

Quick demo showing the use of dojo.Stateful APIs for derived values in a data model,and binding between model and form dijits in the view. The goal is to show a simple means to conform to MVC patterns in UI design and also to emulate constraint-based "derived" values in the data model using an image resize dialog.

Try changing either the absolute or relative image sizes and observe the effects on the derived values. Changes can be made in either direction (absolute->relative or vice versa), and also with the aspect ratio pegged or not.

While the demo does not actually implement a constraint-based dependency graph between the values, the dojo.Stateful API along with simple checks to detect and break cycles are sufficient to get pretty close...

The dojo.Stateful watch() fn is used both in the model for derived values and to watch changes on both sides of the Model-View split to resync values as they change in either place. Check out layer.js for details...

Attachments (1) (29.9 KB) - added by cwiecha 12 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 12 years ago by James Burke

Owner: changed from anonymous to Dustin Machi

I think dmachi said he would look at this.

Changed 12 years ago by cwiecha

Attachment: added

comment:2 Changed 12 years ago by bill

Milestone: 1.51.6

1.5 is released, moving remaining tickets to 1.6

comment:3 Changed 11 years ago by bill

Milestone: 1.6future

(sadly) punting seemingly abandoned ticket and meta tickets to future

comment:4 Changed 6 years ago by dylan

Component: GeneralDemos
Milestone: future1.12
Owner: changed from Dustin Machi to cwiecha
Status: newpending

We would love to revisit this and add to the demos site, if there's interest in revisiting this.

comment:5 Changed 6 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Note: See TracTickets for help on using tickets.