gwtbootstrap3 / gwtbootstrap3-extras

Extra (third party) wrappers for GwtBootstrap3
Apache License 2.0
43 stars 89 forks source link

Select widget with resources : wrong JS path. #310

Closed andrei-taras closed 8 years ago

andrei-taras commented 8 years ago

Hello,

There appears to be a problem with GWTBootstrap 's select. I'm getting this error (TypeError) : $wnd.jQuery(...).selectpicker is not a function Despite seeing this error reported several times around here, I do not understand why other people seems to have solved it. Maybe they're using a different version, or including JS resources in a different way (manually?).

If you look in SelectClientBundle#SELECT_JS, you will notice that the referenced JS does not contain the "resource" folder in its path, like it happens in DateTimePickerClientBundle for example.

This happens for me in v0.9.3 In my .gwt.xml, I'm including:

<inherits name="org.gwtbootstrap3.GwtBootstrap3"/>
<inherits name="org.gwtbootstrap3.extras.select.Select"/>

In my case, I was able to workaround this error, by manually including the mentioned JS resource in a custom ClientBundle of mine :

public interface Gwtbootstrap3Resource extends ClientBundle {
    Gwtbootstrap3Resource INSTANCE = GWT.create(Gwtbootstrap3Resource.class);

    @Source("org/gwtbootstrap3/extras/select/client/resource/js/bootstrap-select-1.10.0.min.cache.js")
    TextResource selectJs();
}

and then, manually injecting it during startup of the app: ScriptInjector.fromString(Gwtbootstrap3Resource.INSTANCE.selectJs().getText()).setWindow(ScriptInjector.TOP_WINDOW).setRemoveTag(false).inject();

Kind regards, Andrei

crevete commented 8 years ago

Thanks for the report. This is the same issue as #308. Please join it.

crevete commented 8 years ago

If you look in SelectClientBundle#SELECT_JS, you will notice that the referenced JS does not contain the "resource" folder in its path, like it happens in DateTimePickerClientBundle for example.

In fact, the resource folder is in src/main/resource, but for client bundle, it would better move it to src/main/java