Wednesday, April 1, 2015

Injecting JavaScript(JSNI) to Cell Table DOM

Hi,
In my application i am using GWT Cell Table, for some of the Column Header i want to add tooltip.Column Header is created by using SafeHtml and Injecting JS to cell table header using JSNI. But that time the DOM is not creating and JavaScript is not attaching to the column Header for tooltip.If i use Timer then the Problem is goes off,I don't want to use Timer.Is there any Way to inject JS?Any Clue?See below code,

Column Header SafeHtml:
SafeHtml="<span>Total</span><span title='' rel='tooltipTop' class='reqFull' data-original-title='{0}'> <i class='fa fa-info-circle'></i></span>";

JSNI:
 private static native void initTooltip() /*-{
    $wnd.$(document).ready(function(){
    $wnd.jQuery("[rel=tooltipTop]").tooltip({ placement: 'top'});
    });
    
    }-*/;

I am Calling this JSNI after the table creation but still DOM is not ready.
Even i tried calling this JSNI Script in onAttach() Method,

@Override
protected void onAttach() {
super.onAttach();
initTooltip();
}

Any Suggestion?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment