Hello,
I try to integrate a Javascript library for pivot tables into a Vaadin 6 application. My init method looks like this:
[code]
@Override
public void init() {
try {
Window mainWindow = new Window("Testpivot Application");
CustomLayout cl;
cl = new CustomLayout(new ByteArrayInputStream("<div id='pivot'></div>".getBytes()));
cl.setSizeFull();
mainWindow.executeJavaScript("$(function(){$(\"#pivot\").pivot([ {color: \"blue\", shape: \"circle\"}, {color: \"red\", shape: \"triangle\"}]
,{rows: ["color"]
,cols: ["shape"]
});});");
mainWindow.addComponent(cl);
setMainWindow(mainWindow);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
[/code]I extended the class ApplicationService as follows:
[code]
@SuppressWarnings(“serial”)
public class MyApplicationServlet extends ApplicationServlet {
@Override
protected void writeAjaxPageHtmlHeader(BufferedWriter page, String title,
String themeUri, HttpServletRequest request) throws IOException {
super.writeAjaxPageHtmlHeader(page, title, themeUri, request);
page.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + request.getContextPath() + "/VAADIN/pivottable/pivot.css\">");
page.write("<script type=\"text/javascript\" src=\"" + request.getContextPath() + "/VAADIN/pivottable/jquery-1.8.3.js\"></script>");
page.write("<script type=\"text/javascript\" src=\"" + request.getContextPath() + "/VAADIN/pivottable/jquery-ui-1.9.2.custom.js\"></script>");
page.write("<script type=\"text/javascript\" src=\"" + request.getContextPath() + "/VAADIN/pivottable/pivot.js\"></script>");
}
}
[/code]The HTML written by the application seems to be ok. I checked it with the javascript tools of chrome. No error is thrown in the console. But the application is not showing the pivot table although a table structure is created in the div element by using the CustomLayout.
Any help is really appreciated.
Many thanks in advance,
Till