Topic: how to count child nodes and how to validate on rename() ?

Hi,

  • Is there a way to count child nodes of any given parent?

  • How can I validate the node's new name on rename()? I think I can just call rename() and restore the previous name if the validation fails, but perhaps there's already a built-in functionality for this?

Regards,

[ simon.cpu ]

Re: how to count child nodes and how to validate on rename() ?

Not again. I'm answering my own question. node.recursive() works for counting the child nodes.  lol lol lol

Re: how to count child nodes and how to validate on rename() ?

there is no build-in validation functionality

Re: how to count child nodes and how to validate on rename() ?

Hi,

In case someone needs to validate on rename, just do something like:

tree.addEvent('rename', function (node, name_new, name_old) {
    // do validation here
});

where tree is an instance of Mif.Tree