JSFiddle - React, Tailwind, and code Playground

by fkhairzad

HTML

<script src="http://www.google.com/jsapi?fake=.js"></script>
<div id="table"></div>

JavaScript

function drawTable () {
    // Create and populate the data table.
    var data = google.visualization.arrayToDataTable([
        ['Name', 'Height', 'Smokes'],
        ['Tong Ning mu', 174, true],
        ['Huang Ang fa', 523, false],
        ['Teng nu', 86, true]
    ]);
    
    // Create and draw the visualization.
    var table = new google.visualization.Table(document.getElementById('table'));
    
    function setWidth () {
        // set the width of the column with the title "Name" to 100px
        var title = 'Name';
        var width = '200px';
        $('.google-visualization-table-th:contains(' + title + ')').css('width', width);      
    }
    google.visualization.events.addListener(table, 'ready', setWidth);
    google.visualization.events.addListener(table, 'sort', setWidth);
    
    table.draw(data, null);
}

google.load('visualization', '1', {packages: ['table']});
google.setOnLoadCallback(drawTable);