Rendering data in a WTableView
Added by Sean Lynch over 13 years ago
I have a bunch of data in a WTable.
It works out fine but as the application is used the table will get bigger and bigger. I'm thinking it would be much more flexible to use WTableView to render the data. I have a question about how to use this.
Currently one column of the table has cells that are rendered as follows:
new Wt::WText(Wt::WString("Some Text"), table->elementAt(row, 1));
new Wt::WBreak(table->elementAt(row, 1));
new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, "/link/" + pathname(),
"Link",
table->elementAt(row, 1));
Is it possible to do something like this with multiple inline widgets in a cell of a WTableView?
Replies (1)
RE: Rendering data in a WTableView - Added by Koen Deforche over 13 years ago
Hey,
Yes, certainly. The only constraint that WTableView imposes is that all rows have equal height.
To customize how a single item is rendered, you need to specialize WAbstractItemDelegate (or WItemDelegate if the default implementation is useful to reuse).
You will need to make sure to override the CSS line-height property set by default on the lines to be able to fit more than a single line of text
inside a cell.
Regards,
koen