dabeng/OrgChart

in content display html content

Paul75 opened this issue · 1 comments

Paul75 commented

Hello,

When I can display in the content with html content ?

For exemple I want to add text seams :

Dupont Jean
------------------
Fred Dupont
Roger RRRRR
Mike Jason

... with links in lines for exemple ....

Thanks

dabeng commented

Hi @Paul75 I create a demo on codepen.io for you -- https://codepen.io/dabeng-the-styleful/pen/YzgzEGp . The core snippets are shown below:

    var nodeTemplate = function(data) {
      return `
        <div class="title">${data.name}</div>
        <div class="content">
          ${data.members.map(member => `
            <li>${member.name}</li>
          `).join('')}
        </div>
      `;
    };

    var oc = $('#chart-container').orgchart({
      'data' : ds,
      'nodeTemplate': nodeTemplate
    });