Bug #7707
openToggling visibility for WTreeView on column 0 breaks webserver
0%
Description
Press button twice to reproduce.
Environment: Window10, FireFox, Wt4.3.1
Example:
class Application : public Wt::WApplication
{
public:
Application(const Wt::WEnvironment& enviorment) : Wt::WApplication(enviorment) {}
class Tree : public Wt::WTreeView
{
public:
Tree() {}
void toggle()
{
setColumnHidden(0, !isColumnHidden(0));
}
};
/***************************************************************/
void initialize()
{
WApplication::initialize();
auto tree = root()->addNew<Tree>();
tree->resize(500, 500);
Wt::WStringListModel* m = new Wt::WStringListModel;
std::vector<Wt::WString> ss;
ss.push_back("a");
ss.push_back("b");
ss.push_back("c");
ss.push_back("d");
m->setStringList(ss);
tree->setModel(std::unique_ptr<Wt::WStringListModel>(m));
auto btn = root()->addNew<Wt::WPushButton>();
btn->resize(100, 100);
btn->clicked().connect(tree, &Tree::toggle);
}
}
Files
Updated by Roel Standaert about 3 years ago
Weird thing to do but it indeed causes a JavaScript error (doesn't break the web server, just that one instance of WApplication
).
Updated by Ulf Johnsson about 3 years ago
Yes, my bad, thats what I meant, its breaks the connection to current session.
It is indeed a weird thing to do in the example above, but I think the issue was present even when having more columns?
And in that case it is not a strange thing to do. If I have, for example, 5 columns it is not unheard of to hide column at position 0.
Updated by Roel Standaert about 3 years ago
Well, it's a WTreeView
, so then you'd be hiding the tree, so I wouldn't know what it should do. I don't know what you think it should do. It can be a no-op, we can throw an exception, we could preserve the tree structure from column zero but not show the data from column 0, but something tells me the current implementation won't make that easy.
Updated by Ulf Johnsson about 3 years ago
- File qt_treeview_0_hidden.png qt_treeview_0_hidden.png added
- File qt_treeview_0_visible.png qt_treeview_0_visible.png added
Taking inspiration from Qt, they simple hide the graphical part of the column and leave the other column as is (expanded children and parents).
Visible column 0
Hidden column 0