html - SmartGWT / GWT accessing div created in constructor via javascript -


i trying integrate custom javascript library smartgwt project.

i have areas of page loaded dynamically via button clicks , in java code have following pseudo code:

button . onclick {     contextarea = new contextareatypea() } 

so contextareatypea created , within constructor want create series of div elements, assign them ids , call function in custom library loads content divs.

smartgwt gets rid of way of getting hold of ids or setting ids on element in page, create ids on elements either have create own widget , override getinnerhtml or create htmlflow , add content myflow.setcontent('<div id="myid" ></div>'); way doing it.

my problem doing in constructor means when come call custom javascript function takes id, div created not seem attached dom yet null pointer.

since module , document loaded , content being dynamically added in can't call document ready or onmoduleload, how , when should detecting load of div , when safe access div within jsni calls?

i have tried multiple methods such adding attach handlers (they never seem called), have tried adding draw handlers htmlflow seem called after drawn htmlflow div before it's drawn contents. have tried calling redraw on htmlflow() doesn't seem call ondraw method @ all.

i have no idea how go integrating library smartgwt, if suggest better (or any) way of doing great.

in plain gwt ovverriding widget.onattach() trick me:

public class mywidget extends widget {      @override     protected void onattach() {         super.onattach();         // call jsni code     }  } 

important things:

  • pay attention super.onattach() call. must fired before jsni call.
  • images loaded after onattach(). if js code tricks images (for example check heights) early.

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -