1

Is it possible to change the html node structure ?

<span role="button" class="fancytree-expander"></span>
<span class="fancytree-title">
    <div class="title">Direction Générale des Services</div>
    <div class="agents">
        <span class="agent">Directeur Général des Services<br>Jean-Marc Lucas<br><i class="fa fa-fw fa-phone"></i>&nbsp;:&nbsp;02 96 13 59 59<br><i class="fa fa-fw fa-envelope"></i>&nbsp;contact@gp3a.bzh</span>
    </div>
</span>

to

<span role="button" class="fancytree-expander"></span>
<span class="fancytree-title">
    <div class="title">Direction Générale des Services</div>
</span>
<div class="agents">
    <span class="agent">Directeur Général des Services<br>Jean-Marc Lucas<br><i class="fa fa-fw fa-phone"></i>&nbsp;:&nbsp;02 96 13 59 59<br><i class="fa fa-fw fa-envelope"></i>&nbsp;contact@gp3a.bzh</span>
</div>

in other words, is it possible to add html node outsite of the span.fancytrre-title ?

Thx

hnefatl
  • 5,860
  • 2
  • 27
  • 49
  • In the future, [format your code snippets](https://stackoverflow.com/editing-help) with proper indentation so that it's easier for people to read. – hnefatl Nov 29 '17 at 09:15

1 Answers1

1

Have a look at the Fancytree events, especially createNode and renderTitle. Example:

function createNode(event, data) {
    // add fake <input/> to the node
    var $input = $("<input/>").val(data.node.title);
    $("span.fancytree-title", data.node.li).before($input);
}
mar10
  • 14,320
  • 5
  • 39
  • 64