HTML links in a table cell

41 views
Skip to first unread message

Greg Slocum

unread,
Sep 18, 2018, 12:57:47 PM9/18/18
to Google Visualization API
I have the code below to display a table.  I'd like to have the material "number" in column 0 serve as a link to an htm file that displays a chart.  I know how to write the href, but not how to put it in the cell in the table.

Any help appreciated.

<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">
      google.charts.load('current', {'packages':['table']});
      google.charts.setOnLoadCallback(drawTable);
    function drawTable() {
      var data = new google.visualization.DataTable();
      data.addColumn('string', 'Material');
      data.addColumn('string', 'Material Description');
      data.addColumn('string', 'Current Value On Hand');
      data.addColumn('string', 'Max Value Next 90 Days');
      data.addColumn('string', 'Current On Hand/Next 90 Requirements');
      data.addColumn('string', 'Max Next 90/Next 90 Requirements');

      data.addRows([
    ['2104348', 'LO1-A07-D-MS', '$654,133', '$654,133', '1.59', '1.59'],
      ]);
        var table = new google.visualization.Table(document.getElementById('table_div'));
          table.draw(data, {showRowNumber: false, width: '100%', height: '100%'});
}</script>
</head>
<body>
  <div id="line_top_x"></div>
  <div id="table_div" style="align: center;  height: 300px;"></div>
</body>
</html>

Greg Slocum

unread,
Sep 19, 2018, 5:16:45 PM9/19/18
to Google Visualization API
in the table.draw command, the allowHtml needs to be there

          table.draw(data, {showRowNumber: false, width: '100%', height: '100%', allowHtml: true});
Reply all
Reply to author
Forward
0 new messages