For the "$", maybe the library is not loaded when you try to create
your chart.
As I told before, you need to write a wrapper. This wrapper create the
div needed by jqPlot and add an unique ID to it. This ID is used as
the first argument to "jqPlot" JavaScript function. But you can't
create your chart in your Widget constructor. The div is not attached
to the DOM so jqPlot will no find it. You need to create your chart
when onLoad is called. This can look like (not tested):
class JqPlot extends Widget {
// Used to generate unique ID
private static int count = 0;
public JqPlot() {
setElement(Document.get().createDivElement());
// Add a unique id to your div
getElement().setId("__jsplot__gwt__" + count++);
}
@Override
public void onLoad() {
// Now the div is attached to the DOM, jqPlot will find it
createGraph(getElement().getId());
}
private native void createGraph(String id) /*-{
...
$.jsPlot(id, ....);
}-*/;
}
But you need many more work. You need to handle multiple call to
onLoad. You need also to wrap all arguments needed by jsPlot and cache
them into your Widget until you create the chart...
You problem is not "jqPlot and MVP", it's just "jqPlot and GWT".
Olivier
On 9 juin, 15:55, Rizen <[email protected]> wrote:
> I want to cast a JavaScriptObject to an Element cause I think is the
> best solution for the moment. Using the MVP architecture I don't know
> how to do that in a different way. If there is something better I will
> be interested as well.
>
> About the problem with $, I wrote typeof($) in FireBug's console. It
> return "function". So I think it's ok for the include, I've tried via
> the .html and the xml configuration.
>
> Thank you very much for your help until now.
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.