Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ListGrid grouped: how to add and remove a TreeNode

    Hi,

    I need to add and remove by code a TreeNode from a grouped ListGrid. The ListGrid is populate from a DataSource bind to a database.

    I have tried this:

    Code:
    //TreeNode cc is a node place on a different level of the grid
    cc.setAttribute("customName", getCustomName());
    grid.getGroupTree().move(cc, parent, position);
    fakeNodes.add(cc); //keep the node in the list so I can find it
    And this add the row just fine.
    But when it comes to remove it, if I do like this:

    Code:
    for (TreeNode child : fakeNodes) {
        if (child.getAttributeAsString("customName").equals(getStringToMatch()))) {
            grid.getGroupTree().remove(child);
            break;
        }
    }
    The "remove" action will freeze the browser, the CPU gets to 100% and I have to kill the browser.

    The ListGrid is populate by DataSource, and the node I need to add is actually a clone of another node, place in a different level.

    I also try to use the add method (So I end uup with two nodes instead that just one), and it also works, but when I try to remove it, the CPU complain.

    Can you give me any help?


    I'm using SmartGWT 3.0.

    Thank you very much
    Barbara

    #2
    During my experiments, I found out that if the added node is created brand new, then the remove call work just fine.

    I recon the problem is due to the fact that in the code I posted, the node I move was already linked to some other object, and the remove call tried to remove also some of the old objects.

    Anyway, it will be helpfull to have a confirm on my guess.

    Thanks
    Barbara

    Comment

    Working...
    X