0

I'm trying to use a third party javascript library in GWT. The library I'm using is dhtmlxGantt v3.3.

I know that you need to use $wnd instead of "window" inside native javascript functions in your GWT client code. But the third party library uses "window" inside the .js file. This causes that the library is not working correct.

Is there a way around this problem?

4
  • 1
    which library is it? Have you verified that there is no gwt-compatible version of it? Commented Oct 2, 2015 at 10:16
  • Are you sure the script is loaded correctly? Commented Oct 2, 2015 at 10:17
  • Is am trying to use dhtmlxGantt v3.3 and there is no specific GWT version I know of. Commented Oct 2, 2015 at 10:25
  • I was able to integrate the chart in my UI, bus the chart has a button to add tasks, this button does not work. When I look in the firebug bug console I see errors on "window" references inside the javascript library. Commented Oct 2, 2015 at 10:31

1 Answer 1

2

The third-party lib needs to be loaded in the "host page".

When called from JSNI, make sure you reference the objects and functions through $wnd (e.g. if it were jQuery, you'd use $wnd.$(element).whatever()).

If you're using ScriptInjector to load the library, make sure you setWindow(ScriptInjector.TOP_WINDOW)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.