cancel
Showing results for 
Search instead for 
Did you mean: 

Event Listeners on Context Elements

Former Member
0 Kudos

Hi all,

does anyone know if there is a way to add Event Listeners to a specific Context Node?

We want to fire a Event when a Node is changed.

Is this possible and how has this to be done?

thanks a lot

Regards

Norbert

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Norbert,

Did the replies help? If so, don't forget to assign points. I gave them some, but feel free to increase them! Click on the Yellow Star icon in each reply. You can give:

1 10 pointer (solves problem)

2 6 pointers (very helpful)

lots of 2 pointers (helpful)

Thanks!

Joan (and Mark Finnern)

Former Member
0 Kudos

Norbert,

wdContext.nodeMyData().getNodeInfo().addNotificationListener
(
    new IWDNodeNotificationListener()
    {
        public void notify
           (
               IWDNode notifiedNode, 
               IWDNode notificationSource,
               Object  payload
           )  
        {
           // Your code goes here
           // However, what you plan to do
           // in light of fact that "payload"
           // value is undocumented and 
           // subject to change??? 
        }
    }
);

WBR,

VS

P.S. Anybody knows how to preserve spaces when posting to these forums???

Message was edited by: Bertram Ganz

Use

 

Former Member
0 Kudos

Hi Valery,

use [_code][_/code] without the '_'.

Regards

Stefan

thomas_chadzelek
Participant
0 Kudos

Hello,

the "Object payload" parameter is not used by Web Dynpro itself. It is up to the application to decide which type is actually used and which content is passed along. Web Dynpro will not change this API, except according to the usual mechanisms. What I want to say is: don't worry that it is "undocumented". We just did not have too much to say about "Object payload".

The application fires the event with the payload, the application provides the listener that accepts the payload. Just like sending a letter. Web Dynpro is the postal service and does not care what is inside the letter.

Best regards,

Thomas

Former Member
0 Kudos

Could someone post code snippets to make this work?

What I want is when a selection in a table (bound to a value node) changes, I want an event to fire that will allow me to get the selected row and get details into another table.

How does the payload object come into play here and exactly how is it used?

Example: A table of Portal Groups and a second table of users belonging to currently selected group.

Thanks,

Andrew

thomas_chadzelek
Participant
0 Kudos

Hello Andrew,

this is something completely different. If you have a table and need to know when the user changes its selection, please attach an action to the table's onLeadSelect event.

The context eventing with payload which I talked about here is used when the application wants to communicate on the server side, between different components. E.g. you have one component supplying data and another consuming data (via a mapping chain), and the consumer needs to react to changes done by the supplier.

For eventing between client (= user) and server (= application) one should use UI events.

Best regards,

Thomas

thomas_chadzelek
Participant
0 Kudos

For performance reasons, there is no eventing mechanism that informs you when the content of a node has changed. For changes of a node's meta information (i.e. context structure; e.g. adding an attribute or removing a child node) there is a framework internal mechanism, but none visible for the application developer. This would probably not be what you need, anyway.

But there is a third mechanism that may help you. If your problem is that one component changes some data somewhere in a node and another component that uses this data via mapping must react, we can help you out. Look at IWDNodeInfo.addNotificationListener(IWDNodeNotificationListener). It allows the using component to register a notification listener. The component changing the data can then use IWDNode.notifyAllMappedNodes(Object) to notify all such listeners, passing along some payload.

If this explanation was too short, please ask further questions.

Former Member
0 Kudos

Hello,

could you please provide a code snippet on how to implement the listener?

Thank you,

Christian

Former Member
0 Kudos

hi again,

we are still looking for a solution to react on changes of the context contents.

Can anyone provide an example of the third mechanism described by Thomas.

Thanks a lot.

Norbert