Version 9, changed by jaredj 02/20/2007. Show version history
This use-case demonstrates how a widget/action on a widget can invoke a publish to a specific topic. The main purpose of this is to demonstrate how widgets could be declaratively wired together through topics and markup. The programmatic side would simply do something like connecting to an event on a widget, which then triggers a call to dojo.event.topic.publish() or the like.
| // Do
not necessarily need a programmatic example; it can be implemented
using the standard dojo.event.topic mechanisms. |
... <!-- Publishes the contents of textBox 'Test1' on exit of the textbox to a topic --> <input type="text" id="Text1" /> <div dojoType="ibm:Action" widgetId="Action1" trigger="Text1" triggerEvent="onblur" topic="textbox1Changed" params="Text1.value"></div> ... |
| <html> <head> <title>Test Binding</title> <script> var djConfig = {isDebug: true}; </script> <script src="../../../../dojo/dojo.js"></script> <script> dojo.registerModulePath("dojox.data", "../dojox/src/data"); dojo.require("dojox.data.decl.Action"); dojo.require("dojox.data.decl.Binding"); </script> </head> <body> <!-- View --> <input type="text" id="Text1" /> <input type="text" id="Text2" /> <div dojoType="ibm:Action" widgetId="Action1" trigger="Text1" triggerEvent="onblur" topic="textbox1Changed" params="Text1"></div> <div dojoType="ibm:Binding" widgetId="Binding1" triggerTopic="textbox1Changed" source="arguments[0]" target="Text2.value"></div> </body> </html> |