Hi All
I'm trying to follow the example "Passing Data Between Widgets" from this link: https://help.hybris.com/1808/hcd/8be2448886691014bf61e8730c819771.html#loio8be2448886691014bf61e8730c819771.
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.