Bug #3027
openProblems with scrolling and row selecting in WTableView
0%
Description
Several months ago I reported a bug with scrolling a WTableView
to the last added row. I've recently updated to Wt 3.3.2 and still have problems with it.
Here's my example:
void addRowAndScroll(Wt::WTableView *view, Wt::WPushButton *btn)
{
Wt::WStandardItemModel *model = dynamic_cast<Wt::WStandardItemModel*>(view->model());
int row = model->rowCount() + 1;
model->appendRow(new Wt::WStandardItem(Wt::WString("row#{1}").arg(row)));
btn->setText(Wt::WString("count#{1}").arg(row));
Wt::WModelIndex index = model->index(model->rowCount() - 1, 0);
view->scrollTo(index);
view->select(index);
}
Wt::WApplication* createApplication(const Wt::WEnvironment& env)
{
Wt::WApplication *app = new Wt::WApplication(env);
app->setTheme(new Wt::WBootstrapTheme);
Wt::WTableView *view = new Wt::WTableView;
view->setSelectionBehavior(Wt::SelectRows);
view->setSelectionMode(Wt::SingleSelection);
view->resize(200, 300);
Wt::WStandardItemModel *model = new Wt::WStandardItemModel(view);
view->setModel(model);
Wt::WPushButton *btn = new Wt::WPushButton("add", app->root());
btn->clicked().connect(boost::bind(&addRowAndScroll, view, btn));
app->root()->addWidget(btn);
app->root()->addWidget(view);
return app;
}
In WBootstrapTheme
scrolling still doesn't work. Also it seems that rows do not fit inside the table: if I add about 20 rows the last row is not visible. Row selection doesn't work too: I click on a row and another becomes highlighted. The more rows I add, the more distance between clicked and highlighted rows is.
In standard theme selection works fine, but scrolling still doesn't. In my example the table scrolls properly only if the last row number is odd.
Updated by Koen Deforche almost 10 years ago
- Status changed from New to Feedback
- Assignee set to Koen Deforche
Hey,
This has been fixed in git, and will be included in the due 3.3.3 release. Can you check that indeed a git version works well?
Regards,
koen
Updated by Alan Finley almost 10 years ago
I've downloaded sources from git and tried it. Row selection works fine, but in my example scrolling to the last row works for even row numbers only.
Updated by Koen Deforche almost 10 years ago
Hey,
I can't reproduce this last problem but it sounds curious. Can you isolate this in a small test case?
Regards,
koen