Google Org Chart mit Hyperlink und 1 Klick erweitern / reduzieren

Ich versuche, das Google Organigramm-Steuerelement zu verwenden. Ich möchte, dass die Knoten mit einem Klick ein- und ausgeblendet werden (anstelle des Standard-Doppelklicks) und ein Hyperlink zur Profilseite des Benutzers bereitgestellt wird.

Mein Hyperlink-Code funktioniert einwandfrei mit dem Standard-Doppelklick zum Erweitern / Reduzieren. Wenn ich jedoch einen Listener für das Ereignis 'select' hinzufüge, um das Erweitern / Reduzieren mit einem Klick zu ermöglichen, funktioniert der Hyperlink nicht mehr.

JSFiddle hierhttps: //jsfiddle.net/oxzabtyg

hier ist mein Code

 google.charts.load('current', {packages:["orgchart"]});
      google.charts.setOnLoadCallback(drawChart);

   function drawChart() {
        var data = new google.visualization.DataTable();
        data.addColumn('string', 'Name');
        data.addColumn('string', 'Manager');
        data.addColumn('string', 'ToolTip');
        // For each orgchart box, provide the name, manager, and tooltip to show.
        data.addRows([
          [{v:'Mike', f:'Mike<div><a href="http://www.google.com">google</a></div>'},'', 'The President'],
          [{v:'Jim', f:'Jim<div><a href="http://www.google.com">google</a></div>'},'Mike', 'VP'],
          ['Alice', 'Mike', ''],
          ['Bob', 'Alice', ''],
          [{v:'John', f:'John<div><a href="http://www.google.com">google</a></div>'},'Bob', 'VP'],
          ['Carol', 'Bob', ''],
          [{v:'Jake', f:'Jake<div><a href="http://www.google.com">google</a></div>'},'John', 'VP']
        ]);
        // Create the chart.
        var chart = new google.visualization.OrgChart(document.getElementById('chart_div'));



        // selection
        google.visualization.events.addListener(chart, 'select', function () {
          // get the row of the node clicked
          var selection = chart.getSelection();
          var row = selection[0].row;
          // get a list of all collapsed nodes
          var collapsed = chart.getCollapsedNodes();
          // if the node is collapsed, we want to expand it
          // if it is not collapsed, we want to collapse it
          var collapse = (collapsed.indexOf(row) == -1);
          chart.collapse(row, collapse);
          // clear the selection so the next click will work properly
          chart.setSelection();
                });


         // Draw the chart, setting the allowHtml option to true for the tooltips.
        chart.draw(data, {allowHtml:true, allowCollapse:true});
            }

Antworten auf die Frage(2)

Ihre Antwort auf die Frage