33 views
Skip to first unread message

Dennis Haupt

unread,
Aug 16, 2012, 8:55:52 AM8/16/12
to google-we...@googlegroups.com
i'm trying to add widgets into a flextables header. the header itself required me to add native th / tr elements and add my widgets there:
if (model.header().totalHeaderRowCount() > 0) {
final Element head = DOM.createElement("thead");
for (final int headerRowIndex : CollectionFunctions.range(model.header().totalHeaderRowCount())) {
final Element headerRow = DOM.createElement("tr");
DOM.appendChild(head, headerRow);
for (int col = 0; col < totalColumnCount; col++) {
final HeaderCell cell = model.header().cellAt(headerRowIndex, col);
final Widget widget = createWidget(cell.asTableCellContent());
final Element th = DOM.createTH();
DOM.setElementAttribute(th, "colSpan", String.valueOf(cell.colSpan()));
col += cell.colSpan() - 1;
DOM.appendChild(th, widget.getElement());//<-- important line
DOM.appendChild(headerRow, th);
}
DOM.insertChild(grid.getElement(), head, 0);
}
}

everything works, except for events. they seem to get lost somewhere and don't reach the listeners anymore.
how can i fix it?

Thad

unread,
Aug 16, 2012, 5:58:48 PM8/16/12
to google-we...@googlegroups.com, d.ha...@googlemail.com
There's a lot lacking in FlexTable. If you need <th>, <thead>, etc. I think you need CellTable or DataGrid. They extend AbstractCellTable which (from looking at the code) includes all that. The javadoc's say you can add custom Header's that take events. (I've scant experience with the com.google.gwt.user.cellview.client package. It's a challenge.) 
Reply all
Reply to author
Forward
0 new messages