Triggering data binding events dynamically

asked 2010-03-08 07:53:00 +0800

raevel2 gravatar image raevel2
72 1 2

I have several cases where I use data bindings and I want to specify the load-after event. Sometimes the element i want to listen to is dynamically generated and I cannot give it an id.

So, I'm thinking that i want to trigger load-after using java code in my controller. This way I wouldn't have to make sure that I specify all UI components that might cause my model objects to change.
I was also thinking that it might be nice if I could create custom events in my controller and use those to trigger the load. Then my controller wouldn't have to keep track of all UI components that need to be updated.

Is any of this possible to do?

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2010-03-08 16:55:12 +0800

caclark gravatar image caclark
1753 2 5

Have you looked into Events.postEvent() or .sendEvent()? here's an example of me sending my own custom event:

    Events.postEvent( new Event( "onVehicleRequestSaved", this.self, vehicleRequest ) ) ;

So anyone listening to my window (this.self) for the onVehicleRequestSaved event will get it and the event data will be the vehicleRequest (an instance of VehicleRequest). You can use any component for the Event's second parameter and the third parameter is optional.

link publish delete flag offensive edit

answered 2010-03-09 06:43:46 +0800

raevel2 gravatar image raevel2
72 1 2

Turns out I was thinking about this backwards, but the question I asked was the one I should have asked :-)

Yeah, your solution is exactly what I am looking for.


link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2010-03-08 07:53:00 +0800

Seen: 376 times

Last updated: Mar 09 '10

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More