Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

I'm considering switching the event mechanism either to something simpler (just using jQuery), or to something more sophisticated (e.g. backbone.js). Opinions welcome!

This tutorial shows the way to do things as of April 10, 2012
Info
Warning

The concepts in this section are important, but the code described here will no longer work!
I do suggest reading it, but don't try running the code...

The fact that we are writing reusable page fragments, rather than whole pages, is very powerful, and will lead to lots of flexibility and code reuse across the OpenMRS ecosystem. But it also means we need to introduce a new (more complicated) paradigm for having fragments communicate with each other. For example, we've just built a fragment that shows a list of encounters. The UI Library module includes a fragment that can use ajax to load a preview of an encounter that you select on a page. Clearly, these two fragments are very useful when combined. But at the same time, neither one of them should depend on the other, since they are both perfectly functional alone, and they can both be used with other fragments too. So in order to make our fragments as flexible and reusable as possible, we need to "decouple" them.

...