开发者

Passing a GWT Widget to a js function

开发者 https://www.devze.com 2023-03-25 19:34 出处:网络
I want to pass a complex widget with many click handlers to a js function, via jsni, so that it is included in a div开发者_开发问答 element of my js code (in fact it\'s for the infoWindow content of t

I want to pass a complex widget with many click handlers to a js function, via jsni, so that it is included in a div开发者_开发问答 element of my js code (in fact it's for the infoWindow content of the maps v3 api).

If I pass the element I loose all my handlers, for some reason. The result is that nothing is triggered when I click on buttons or links.

I thought I could sort it out by first passing a flowpanel and its node and then adding the widget to the flowpanel itslef. But it works sometimes and some times not, in particular not with the infoWindow. The widget appears fine but all handlers won't work.

Please send me any suggestions or ideas you might have!


OK I got the trick from... stackoverflow, suprise ;-)

Here's the post: http://www.google.com/url?sa=D&q=https://stackoverflow.com/questions/6183181/how-to-add-a-custom-widget-to-an-element

So in the end I did the following in my jsni function:

            var newDiv = $doc.createElement('div'); 

the function returns the div as an Element which I in turn wrap in an HTMLPanel using HTMLPanel.wrap and then I add the widget!

0

精彩评论

暂无评论...
验证码 换一张
取 消