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?

Mr P
  • 1
  • 2
  • 1
    which library is it? Have you verified that there is no gwt-compatible version of it? – francesco foresti Oct 02 '15 at 10:16
  • Are you sure the script is loaded correctly? – thommylue Oct 02 '15 at 10:17
  • Is am trying to use dhtmlxGantt v3.3 and there is no specific GWT version I know of. – Mr P Oct 02 '15 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. – Mr P Oct 02 '15 at 10:31

1 Answers1

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)

Thomas Broyer
  • 64,353
  • 7
  • 91
  • 164