What is the best method to exchange single event driven information/data between different displays?

Q

What is the best method to exchange single event driven information/data between different displays?

A

The best way to exchange data or information between two different displays or within the same display is using the "trigger" method.

There a two functions available in webMI. One "fires" a trigger of a specified "name" along with a parameter, the other one allows to hook a function to that "named" trigger and is called when the trigger is fired.

 

a.)webMI.trigger.fire(triggerName,value,scope)
b.)webMI.trigger.connect(triggerName, function(e){}, scope)

Examples of a trigger relation in the same display:


webMI.trigger.fire("hallo","MyValue");
webMI.trigger.connect("hallo", function(e) { alert(e.value);});

Examples of a trigger relation between two different displays:


webMI.trigger.fire("hallo","MyValue","OtherDisplay");
webMI.trigger.connect("hallo", function(e) { alert(e.value);},""); 

If two double quotes (empty) are specified as scope in the connect function like above, then webMI will automatically replaced them during the call by the display name the function was called from.

If in the example this display would be namd "Otherdisplay" the trigger would be fired. Of course you can specify any text string instead of two double quotes. If the same string is used in the fire
    function then the trigger is fired.