marwijn
unread,Jun 22, 2012, 3:38:08 AM6/22/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google Web Toolkit
Hello Everyone,
I'm trying to print a cellTable which is not shown on the screen.
However the table is not shown in the print.
The code below is a simplied version that reproduces the problem.
If I try to print the visible cellTable everything works fine.
Printing a new table directly after constructing does not work.
Any suggestions would be welcome.
Thanks in advance.
Marwijn.
package printsprike.client;
import java.util.Arrays;
import java.util.List;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.cellview.client.CellTable;
import com.google.gwt.user.cellview.client.TextColumn;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.RootPanel;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class PrintSpike implements EntryPoint {
List<String> items = Arrays.asList("a", "b", "c");
public void onModuleLoad() {
final CellTable<String> cellTable = createTable();
RootPanel.get().add(cellTable);
final Button printButton = new Button("Print");
printButton.addClickHandler(new ClickHandler(){
@Override
public void onClick(ClickEvent event) {
Print.it(createTable());
}});
RootPanel.get().add(printButton);
}
private CellTable<String> createTable() {
final CellTable<String> cellTable = new CellTable<String>();
final TextColumn<String> column = new TextColumn<String>(){
@Override
public String getValue(String object) {
return object;
}
};
cellTable.addColumn(column, "columnName");
cellTable.setRowData(items);
return cellTable;
}
}