on 2018 Sep 25 12:28 AM
Hi All
I'm trying to follow the example "Passing Data Between Widgets" from this link: https://help.hybris.com/1808/hcd/8be2448886691014bf61e8730c819771.html#loio8be2448886691014bf61e8730...
I have created my controller, the definition.xml and the zul file. I'm able to add the widget to my custom backoffice and when I click on the "Send" button I'm able to debug the controller and see that the value is been send to "outgoingMsg".
However never get the value in @SocketEvent(socketId = "incomingMsg") and for this reason the label on the page is never been updated.
This is the code I have in my local..
---------------------------------------------CONTROLLER -----------------------------------------------------------------------------
public class MyChatController extends DefaultWidgetController
{ private Label lastMsgLabel; private Textbox msgInput;
@ViewEvent(componentID = "sendBtn", eventName = Events.ON_CLICK)
public void sendMsg()
{
sendOutput("outgoingMsg", msgInput.getText());
}
@SocketEvent(socketId = "incomingMsg")
public void updateTranscript(final String msg)
{
lastMsgLabel.setValue(msg);
}
}
-------------------------------------------------------------------definition.xml-------------------------------------------------------
<name>My Chat</name>
<description>My chat widget.</description>
<defaultTitle>My chat</defaultTitle>
<author>Me</author>
<version>0.1</version>
<controller class="org.sigmabackoffice.widgets.mychat.MyChatController"/>
<sockets>
<input type="java.lang.String" id="incomingMsg"/>
<output type="java.lang.String" id="outgoingMsg"/>
</sockets>
<keywords>
<keyword>Chat</keyword>
</keywords>
-------------------------------------------------------------------mychat.zul-------------------------------------------------------
<div>
<textbox id="msgInput"/>
<button id="sendBtn" label="Send"/>
</div>
<div>
<label id="lastMsgLabel" value="No message."></label>
</div>
I'm attaching the structure of my local project and how the widget looks like, any help is appreciated.

Request clarification before answering.
Hi, you didnt fill the last step, in fact you need to have two copies of your widgets inserted in the perspective to be able to pass data between them. you'll need to make a widget-connection config between the widgets you'll use. in the end of the tutorial page you can see :
Procedure Using the Application Orchestrator mode, add two copies of your newly created chat widget inside a layout that allows multiple widgets. The description how to do it can be found in the Orchestrating Backoffice Application document.
use this link to finish the procedure :
https://help.hybris.com/1808/hcd/8be1f02d866910148f62a3da0291222b.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
At the end I added the 2 widgets and connected them with the Orchestrating Backoffice. I also tried adding the configuration in mycustom-backoffice-widgets.xml file as below and see the correct result.
<widget id="mychatOne" widgetDefinitionId="de.hybris.sigma.backoffice.widgets.mychat"
slotId="mychatOne" template="false">
</widget>
<widget id="mychatTwo" widgetDefinitionId="de.hybris.sigma.backoffice.widgets.mychat"
slotId="mychatTwo" template="false">
</widget>
<widget-connection sourceWidgetId="mychatOne" outputId="outgoingMsg" targetWidgetId="mychatTwo"
inputId="incomingMsg" />
<widget-connection sourceWidgetId="mychatTwo" outputId="outgoingMsg" targetWidgetId="mychatOne"
inputId="incomingMsg" />
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.