I am attempting to using the Wt web framework to create a HTML table object. I cannot see a way of adding the table gridlines (a la border="1" in an HTML table) to the table. I can encapsulate the entire table widget with a border using
partTable->decorationStyle().setBorder(border);
Thanks!
You can style your table using CSS.
Create a stylesheet:
.my-table td {
border: 1px solid black;
}
Add it to your application:
wApp->useStyleSheet("my_stylesheet.css");
Then set the my-table
css class to your table:
table->addStyleClass("my-table");
Or you can set WCssDecorationStyle
to every table cell:
const Wt::WBorder border(Wt::WBorder::Solid, 1);
for (int i = 0; i < table->rowCount(); ++i)
{
for (int j = 0; j < table->columnCount(); ++j)
{
table->elementAt(i, j)->decorationStyle().setBorder(border);
}
}