Ok I have removed the MVP part and with this code you can reproduce
the problem in GWT.
private FlowPanel container;
private PieChart piechart;
public void onModuleLoad() {
// display initial Piechart with Testdata
container = new FlowPanel();
piechart = new PieChart();
container.add(piechart);
RootPanel.get().add(container);
piechart.draw(createTable(),createOptions());
// add Button which clears the container Panel and redraws the
piechart
Button button = new Button("reload");
container.add(button);
button.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
container.clear();
container.add(piechart1);
piechart.draw(createTable(),createOptions());
}
});
}
createTable and creatOptions are just functions which create some
sample DataTable and Visualization Options (taken from another sample)
Apparantly when I clear the container FlowPanel and then re-add
(reattach) the piechart some reference is lost because as soon as I
call draw on the reattached piechart I get following exception:
Caused by: com.google.gwt.core.client.JavaScriptException:
(TypeError): a is null
fileName:
http://www.google.com/uds/api/visualization/1.0/defe3df15750b02ac04b4018cb88c896/default,browserchart,piechart.I.js
lineNumber: 504
stack: ()@
http://www.google.com/uds/api/visualization/1.0/
defe3df15750b02ac04b4018cb88c896/default,browserchart,piechart.I.js:
504
([object Object],[object Object])@
http://www.google.com/uds/api/
visualization/1.0/defe3df15750b02ac04b4018cb88c896/
default,browserchart,piechart.I.js:528
()@
http://www.google.com/uds/api/visualization/1.0/
defe3df15750b02ac04b4018cb88c896/default,browserchart,piechart.I.js:
590
([object Object])@
http://www.google.com/uds/api/visualization/1.0/
defe3df15750b02ac04b4018cb88c896/default,browserchart,piechart.I.js:
590
([object Object],[object Object])@
http://www.google.com/uds/api/
visualization/1.0/defe3df15750b02ac04b4018cb88c896/
default,browserchart,piechart.I.js:600
([object Object],[object Object])@http://127.0.0.1:8888:8
I have uploaded a test sample application which allows you to
reproduce the problem (uses two piechart -> one works the other
doesn't). It's actually pure GWT and Google Visualization (no MVP or
other library used).
http://rapidshare.com/files/425754405/gwtvisualizationsample.zip
> >
google-visualizati...@googlegroups.com<google-visualization-
api%2Bunsu...@googlegroups.com>
> > .