Dojo components??

Your demos contain an example where Dojo and toolkit widgets live happily together. I peeked open ajax page’s javascript part but it’s pretty messy (page contains bunch of other stuff that I am not familiar with). Can you help me out a bit, perhaps write cleaner example?

Thank you.

OpenAjax Hub compatibility test-case glues together multiple toolkits and thus is quite complex and messy. Please, could you tell a bit more about your use-case so that we could give a proper example.

You need to understand publish and subscribe methods from OpenAjax HUB. More information exists here:

On OpenAjax demo we basically did the following:

  1. On the server-side with Java, send OpenAjax hub message
  • see example at and method openAjaxPublish
  • Toolkit 4.0.3 or greater required
  1. On the client-side code (themes)
  • subscribe to all IT Mill Toolkit’s OpenAjaxHubDemo events, e.g. OpenAjax.hub.subscribe("com.itmill.toolkit.demo.OpenAjaxHubDemo.**", myJavaScriptMethod);
  • implement your callback function myJavaScriptMethod(name, publisherData) { ... }

Here’s an example of OpenAjax demo callback which was executed every time when Toolkit server sent new data for Dojo Chart. This callback receives JSON, setups chart component and tells it to redraw itself.

// Listens two different publish messages from IT Mill Toolkit
  function dojoChartListener(name, publisherData) {
    if (name == "com.itmill.toolkit.demo.OpenAjaxHubDemo.Table.ValueChangeEvent") {
      var pubData;
	  // evaluoi JSON
      eval("pubData = "+publisherData+";");
      // store on dojon chart objekti

Hope this helps!