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.