Bug #2437
closedItem delegates for WTableView in WBootstrapTheme
0%
Description
When using WBootstrap theme a standard delegate (and all derived) doesn't fit into table cell.
app->setTheme(new Wt::WBootstrapTheme(app));
Wt::WTableView *view = new Wt::WTableView(app->root());
view->setModel(model);
view->setRowHeight(50);
view->setColumnWidth(0, 300);
view->setItemDelegate(new Wt::WItemDelegate);
Here's a screenshot:
Updated by Koen Deforche about 11 years ago
- Status changed from New to Resolved
- Assignee set to Koen Deforche
- Target version set to 3.3.0
Hey,
Bootstrap is indeed a bit aggressive with styling their inputs. The solution is to do:
view->addStyleClass("form-horizontal");
Regards,
koen
Updated by Alan Finley about 11 years ago
That doesn't change anything. The delegate widget still doesn't fit into the cells.
Updated by Koen Deforche about 11 years ago
It works here:
http://www.webtoolkit.eu/widgets/graphics-charts/category-chart
So there's got to be some other difference?
koen
Updated by Alan Finley almost 11 years ago
It doesn't work. WTableView
has the "form-horizontal" class by default. But even if I add it manually it still doesn't help.
Here's my example:
Wt::WApplication*
createApplication(const Wt::WEnvironment& env)
{
Wt::WApplication *app = new Wt::WApplication(env);
app->setTheme(new Wt::WBootstrapTheme(app));
Wt::WStandardItemModel *model = new Wt::WStandardItemModel(app);
for (int i = 0; i < 10; ++i)
{
std::vector<Wt::WStandardItem*> row;
for (int j = 0; j < 5; ++j)
{
Wt::WStandardItem *item = new Wt::WStandardItem;
item->setText(Wt::WString("{1}/{2}").arg(i).arg(j));
item->setFlags(Wt::ItemIsEditable);
row.push_back(item);
}
model->appendRow(row);
}
Wt::WTableView *view = new Wt::WTableView;
view->addStyleClass("form-horizontal");
view->setModel(model);
view->setEditTriggers(Wt::WAbstractItemView::SingleClicked);
view->setRowHeight(28);
view->setItemDelegate(new Wt::WItemDelegate(view));
app->root()->addWidget(view);
return app;
}
I use Wt 3.3.1.
Updated by Alan Finley almost 11 years ago
I don't know why the delegate's layout sets left and top margins for the editor.
Updated by Alan Finley almost 11 years ago
If I reimplement the WItemDelegate::createEditor
method and return a WComboBox
as an editor, it has correct size and postion.
Updated by Koen Deforche almost 11 years ago
- Target version changed from 3.3.0 to 3.3.2
Hey,
It seems recent browsers no longer suffer from a bug which we were working around. Different browser versions explain the consequente confusion, but I finally see what you see and I've got a fix ready.
Regards,
koen
Updated by Alan Finley almost 11 years ago
Koen Deforche wrote:
It seems recent browsers no longer suffer from a bug which we were working around. Different browser versions explain the consequente confusion, but I finally see what you see and I've got a fix ready.
Can I see a patch or a link to Github?
Updated by Koen Deforche almost 11 years ago
- Status changed from Resolved to Closed