google-code-export / wiquery

Automatically exported from code.google.com/p/wiquery
MIT License
1 stars 1 forks source link

Sortable JavaScript error #139

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I've upgraded to 1.1.1 from 1.0.2 and noticed the Sortable scripts seem to be 
broken.

The scripts are included using:

@Override
public void contribute(WiQueryResourceManager qrm) {
    qrm.addJavaScriptResource(CoreUIJavaScriptResourceReference.get());
    qrm.addJavaScriptResource(SortableJavaScriptResourceReference.get());
}

Which results in this error:

$.widget is not a function
http://localhost:8080/resources/org.odlabs.wiquery.ui.sortable.SortableJavaScrip
tResourceReference/jquery.ui.sortable.js
Line 1052

Original issue reported on code.google.com by norc...@gmail.com on 29 Nov 2010 at 1:15

GoogleCodeExporter commented 9 years ago
Hi Norckonn,

The error raising is normal because since jQuery UI 1.8, jQuery UI elements are 
"Widget". So, we need to import the Widget resource file (example on this link: 
http://code.google.com/p/wiquery/source/browse/trunk/src/main/java/org/odlabs/wi
query/ui/sortable/SortableBehavior.java#168)

This is a custom statement or did you find it in wiQuery ? If this is your 
statement, you can avoid calling CoreUIJavaScriptResourceReference.get() with 
the annotation @WiQueryUIPlugin (plus, the stylesheet will be imported too). 
Otherwise, can you tell me where did you find it please ?

Regards

Julien Roche

Original comment by roche....@gmail.com on 29 Nov 2010 at 1:32

GoogleCodeExporter commented 9 years ago
That's really weird:-( I you look into [1] you will see the code is: 

  @Override
        public void contribute(WiQueryResourceManager wiQueryResourceManager) {
                wiQueryResourceManager.addJavaScriptResource(WidgetJavascriptResourceReference.get());
                wiQueryResourceManager.addJavaScriptResource(MouseJavascriptResourceReference.get());
                wiQueryResourceManager
                                .addJavaScriptResource(SortableJavaScriptResourceReference.get());
        }

So, either: 

1- 1.1.1 jars where generated wrong or 
2- you are picking up classes from other jar file

Can you check that please? 

Regards,

Ernesto

1-http://code.google.com/p/wiquery/source/browse/tags/1.1.1/src/main/java/org/od
labs/wiquery/ui/sortable/SortableBehavior.java

Original comment by reier...@gmail.com on 29 Nov 2010 at 1:37

GoogleCodeExporter commented 9 years ago
That makes sense :) 

The contribute method is my own. I've updated it to use 
SortableBehavior.contribute() instead, and added the suggested annotation. I'm 
not using the behavior directly because I had to extend the functionality 
provided in 1.0.x.

Works like a charm, thanks for the quick reply!

Original comment by norc...@gmail.com on 29 Nov 2010 at 1:42

GoogleCodeExporter commented 9 years ago
If you happen to use your own versions of draggables/droapbles and so on... 
check those too:-)

Regards,

Ernesto

Original comment by reier...@gmail.com on 29 Nov 2010 at 1:48