12

Google Chart Table 列に HTML リンクを追加しようとしています。列とテーブルの両方に setHTML: true を設定しましたが、HTML コードを解釈する代わりに表示するだけです。誰かが私を正しい方向に向けることができますか?

ありがとう

<!--
You are free to copy and use this sample in accordance with the terms of the
Apache license (http://www.apache.org/licenses/LICENSE-2.0.html)
-->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>
      Google Visualization API Sample
    </title>
    <script type="text/javascript" src="http://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load('visualization', '1', {packages: ['table']});
    </script>
    <script type="text/javascript">

     function drawVisualization() {
      // Create and populate the data table.
      var data = google.visualization.arrayToDataTable([
        ['Name', 'Logged In'],

        ['<a href="LINK">Item 1</a>', 'Item 2'],
     ]);

       data.setColumnProperty(0, {allowHTML: true});
   // Create and draw the visualization.
   visualization = new google.visualization.Table(document.getElementById('table'));
       visualization.draw(data, {allowHTML: true});
    }

   google.setOnLoadCallback(drawVisualization);
    </script>
  </head>
  <body style="font-family: Arial;border: 0 none;">
    <div id="table"></div>
  </body>
</html>
​
4

3 に答える 3

14

allowHTML プロパティは大文字と小文字を区別します。{allowHtml: true} である必要があります。

于 2013-01-15T17:40:09.043 に答える
2

フォーマッターを使用する必要があります。

値を HTML に置き換えると、並べ替えが正しく機能しません。

于 2015-03-31T14:05:51.763 に答える