Project

General

Profile

Actions

Bug #3650

closed

WTreeTable doesn't render child nodes properly if they are added after tree root is expanded

Added by Anonymous about 10 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

Using the example in the documentation:

namespace {
    Wt::WTreeTableNode *addNode(Wt::WTreeTableNode *parent, const char *name,
                const char *yuppie, const char *holidays,
                const char *favorite) {
    Wt::WTreeTableNode *node = new Wt::WTreeTableNode(name, 0, parent);
    node->setColumnWidget(1, new Wt::WText(yuppie));
    node->setColumnWidget(2, new Wt::WText(holidays));
    node->setColumnWidget(3, new Wt::WText(favorite));
    return node;
    }
}


Wt::WTreeTable *treeTable = new Wt::WTreeTable();

treeTable->resize(650, 200);
treeTable->tree()->setSelectionMode(Wt::ExtendedSelection);
treeTable->addColumn("Yuppie Factor", 125);
treeTable->addColumn("# Holidays", 125);
treeTable->addColumn("Favorite Item", 125);

Wt::WTreeTableNode *root = new Wt::WTreeTableNode("All Personnel");
treeTable->setTreeRoot(root, "Emweb Organigram");

Wt::WTreeTableNode *group;

group = new Wt::WTreeTableNode("Upper Management", 0, root);
addNode(group, "Chief Anything Officer", "-2.8", "20", "Scepter");
addNode(group, "Vice President of Parties", "13.57", "365", "Flag");
addNode(group, "Vice President of Staplery", "3.42", "27", "Perforator");

group = new Wt::WTreeTableNode("Middle management", 0, root);
addNode(group, "Boss of the house", "9.78", "35", "Happy Animals");
addNode(group, "Xena caretaker", "8.66", "10", "Yellow bag");

group = new Wt::WTreeTableNode("Actual Workforce", 0, root);
addNode(group, "The Dork", "9.78", "22", "Mojito");
addNode(group, "The Stud", "8.66", "46", "Toothbrush");
addNode(group, "The Ugly", "13.0", "25", "Paper bag");

root->expand();

If we move the root->expand() call:

namespace {
    Wt::WTreeTableNode *addNode(Wt::WTreeTableNode *parent, const char *name,
                const char *yuppie, const char *holidays,
                const char *favorite) {
    Wt::WTreeTableNode *node = new Wt::WTreeTableNode(name, 0, parent);
    node->setColumnWidget(1, new Wt::WText(yuppie));
    node->setColumnWidget(2, new Wt::WText(holidays));
    node->setColumnWidget(3, new Wt::WText(favorite));
    return node;
    }
}


Wt::WTreeTable *treeTable = new Wt::WTreeTable();

treeTable->resize(650, 200);
treeTable->tree()->setSelectionMode(Wt::ExtendedSelection);
treeTable->addColumn("Yuppie Factor", 125);
treeTable->addColumn("# Holidays", 125);
treeTable->addColumn("Favorite Item", 125);

Wt::WTreeTableNode *root = new Wt::WTreeTableNode("All Personnel");
treeTable->setTreeRoot(root, "Emweb Organigram");
root->expand();

Wt::WTreeTableNode *group;

group = new Wt::WTreeTableNode("Upper Management", 0, root);
addNode(group, "Chief Anything Officer", "-2.8", "20", "Scepter");
addNode(group, "Vice President of Parties", "13.57", "365", "Flag");
addNode(group, "Vice President of Staplery", "3.42", "27", "Perforator");

group = new Wt::WTreeTableNode("Middle management", 0, root);
addNode(group, "Boss of the house", "9.78", "35", "Happy Animals");
addNode(group, "Xena caretaker", "8.66", "10", "Yellow bag");

group = new Wt::WTreeTableNode("Actual Workforce", 0, root);
addNode(group, "The Dork", "9.78", "22", "Mojito");
addNode(group, "The Stud", "8.66", "46", "Toothbrush");
addNode(group, "The Ugly", "13.0", "25", "Paper bag");

Only the first level children are visible in the tree. This is not expected!

Actions #1

Updated by Koen Deforche about 10 years ago

  • Status changed from New to InProgress
  • Assignee set to Koen Deforche
  • Target version set to 3.3.4
Actions #2

Updated by Koen Deforche about 10 years ago

  • Status changed from InProgress to Resolved
Actions #3

Updated by Koen Deforche over 9 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF