views:

15

answers:

1

His,

I am using UiBinder whenever possible to improve application performance when possible. However, as far as I understand, UiBinder is at its best when corresponding template contains losts of static information.

In my case, mobile app, most of the screen areas contain dynamic information. For instance, there is a panel with buttons, but you dont know ahead of time how many buttons are shown at a single time. That is why I am using HTMLPanel.add(Widget wgt, String id) or FlowPanel.add() methods in the owning UiBinder class. Isnt that diminishes use of UiBinder and ablility to call setInnerHTML() instead of creating elements trough DOM operations because these add() methods only accept widgets and not elements?

Maybe there is a trick which would allow to add Element object instead of Widget objects to panels and they would then use setInnerHTML to its fullest?

Thanks

A: 

In some cases (which unfortunately exclude buttons, because of IE), you can just add DOM elements and/or use innerHTML (on DOM elements, do not use panel widgets in this case) and listen to events at a higher level (generally your UiBinder owner widget), taking advantage of event bubbling. In other words: use what's generally called "event delegation".

Thomas Broyer