tags:

views:

16

answers:

1

I am using google-tables with a dataview, and I cannot figure out how to get any kind of formatting on one of my columns.

  var datatable = createGoogleData(...);
  datatable.setColumnProperty(2, 'className', 'hest1'); // <--- doesnt work
  var view = new google.visualization.DataView(datatable);
  ...
  view.setColumns([0, 1, { calc: blabla, type: 'string', label: 'blabla', 
       id: 'hest2'}]); // <---- doesnt work
  var table = new google.visualization.Table(document.getElementById('comment')); 
  table.draw(view);

Even with those two setting (hest1 and hest2) the css class is unchanged.

A: 

I found a work around:

var datatable = createGoogleData(...);
var view = new google.visualization.DataView(datatable);
view.setColumns([0, 1, { calc: f, type: 'string', label: 'blabla']);
var table = new google.visualization.Table(document.getElementById('comment')); 
table.draw(view, {allowHtml:true});

function f(dataTable, rowNum) {
    return '<span class="google-cg-date-field">'+ dataTable.getValue(rowNum, 3) +'</span>';
}
Cine