3
以下是Google Charts API的表格。我正在嘗試對「Numbers」列進行降序排序。有人知道怎麼做嗎?對錶格進行排序 - Google Chart Tools
<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 = new google.visualization.DataTable();
data.addColumn('string', 'Names');
data.addColumn('number', 'Numbers');
data.addRows(3);
data.setCell(0, 0, 'Name 1');
data.setCell(1, 0, 'Name 2');
data.setCell(2, 0, 'Name 3');
data.setCell(0, 1, 1);
data.setCell(1, 1, 2);
data.setCell(2, 1, 3);
visualization = new google.visualization.Table(document.getElementById('table'));
visualization.draw(data, null);
}
google.setOnLoadCallback(drawVisualization);
</script>
<div id="table"></div>
https://developers.google.com/chart/interactive/docs/gallery/table搜索事件'sort'在這裏尋找遊樂場https://code.google.com/apis/ajax/playground/?type=visualization#sort_event – 2012-05-22 11:12:25