Does Alfresco Share provide any mechanism for Inter Dashlet Communication?

I am trying to understand how to make some connection between dashlets with Alfresco Share. Here is a simple usage example:

We have 2 dashlets, let them be called A and B. I want to be able to fill out the "name" field (let them say "Toto") in and click on the "Submit" button. After you click the submit button in A. B, you should update the greeting, such as Good Morning.

Thanks for answers.

Thanks for your reply. Can you talk a little bit about "let dashlet_b.get.html.ftl send something to dashlet_a.post.html.ftl"?

In dashlet_b.get.html.ftl you have something like this, I think:

<form id="..." action="" method="POST"> <input id="name" type="text" name="name" value=""/> <input type="submit" id="send" value="Send" /></form> 

When you submit the form, it will look for dashlet_b.post.js correctly? How do you actually say to submit the form to dashlet_a.post.js?

+7
source share
2 answers

It is not enough to use the server side dashlet web page to create these dynamic dashlets. In the browser, you need javascript logic to notify another change file. So Alfresco usually does this:

Javascript Dashlet A Browser:

 YAHOO.Bubbling.fire("interDashletMessage", { message: "Hello World." }); 

Javascript Dashlet B Browser:

 YAHOO.Bubbling.on("interDashletMessage", function(layer, args) { var message = args[1].message; alert(message); // or write it to the dashlets HTML content }); 

This will send a message from character A to dashlet B using a special event called "interDashletMessage".

If your B icon displays only a few messages, this may be enough to send data using events. If this is more complicated, your dashlet A should first send the data to the repository, and then trigger the Refresh event, and dashlet B should update its contents from the repository. This will require several web scripts that you may need to write.

+7
source

It is pretty simple, I think.

Each Dashlet is actually a webscript. This way you can have multiple web pages for different uses. As I have dashlet_a. get .html.ftl and dashlet_a. post .html.ftl. In fact, these two are the same web text that just acts on mail and the other on get.

So what can you do, let dashlet_b. get .html.ftl will send something to dashlet_a.post.html.ftl. Therefore, you are sending values ​​from b to a.

The next step is to update dashlet_a, one way is to completely refresh the page, but this is not nice. Which is better: In dashlet_a. post .html.ftl you simply set through YUI / JQuery the value of the field that is defined in dashlet_a. get .html.ftl.

See how a custom dashlet does this by default, such as webview. If you put something in the configuration, the value is displayed directly.

0
source

All Articles