0

It seems to me that the standard behaviour in fancyTree, when adding child nodes is NOT to change the parent node to have a folder icon.

For example, see http://wwwendt.de/tech/fancytree/demo/index.html#sample-multi-ext.html and try adding a child node.

How is it possible to dynamically change the icon of the parent to a "folder" when adding a child?

I thought that I could apply renderTitle() to the parent node, but this did not do anything.

This question Dynamically change icon in fancy tree is similar, but (a) I could not get it to work, and also (b) I wanted a solution that didn't involve having to create new icons.

gordon613
  • 2,770
  • 12
  • 52
  • 81

2 Answers2

1

Folders may be empty, so this status is defined by node.folder = true (not by the fact that children are present or not). So you could set node.folder and call node.render(). Note that setting an additional class may give the same effect, but may get lost when the tree is updated.

mar10
  • 14,320
  • 5
  • 39
  • 64
0

In jquery.fancytree.edit.js I added the following line

newNode.parent.addClass("fancytree-ico-ef");

The code snippet is as follows:

newNode.makeVisible(/*{noAnimation: true}*/).done(function(){
        $(newNode[tree.statusClassPropName]).addClass("fancytree-edit-new");
        self.tree.ext.edit.relatedNode = self;
newNode.parent.addClass("fancytree-ico-ef");
        newNode.editStart();
    });
gordon613
  • 2,770
  • 12
  • 52
  • 81