I created a google visualization dashboard using the Google HTML Service. The underlying datatable (jjdt) is joined from several data tables like jadt2,fa.
jjdt = google.visualization.data.join(jadt2,fa,'left',[[0,0]],[1,2,3,4,5,6,7,8,9,10,11],[2,3]);
And then I created a chart wrapper (finalTable) to show the table in the dashboard.
finalTable = new google.visualization.ChartWrapper({
'chartType': 'Table',
'containerId': 'table-div',
'options': {
'showRowNumber': false,
'width': '100%',
'height': '100%',
'allowHtml': true,
'pageSize': 20
}
});
dashboard.bind(wwPicker, [finalTable]);
dashboard.draw(jjdt);
These code worked OK.
Now what I want to do is to allow a click of button to set certain cells in the underlying table (jjdt) to new values and get it reflected on the dashboard. But that is not as simple as I thought it would be.
I tried 2 things:
1) Using javascript to update the jjdt table for the corresponding cell (x,y) and call the finalTable.draw();
jjdt.setCell(x,y,'New Value');
finalTable.draw();
But this has no effect and no error message.
2) I think maybe the chart wrapper created a copy of datatable. So I try to get that datatable back:
var mydt = finalTable.getDataTable();
mydt.setCell(x,y,'New Value');
finalTable.draw();
I thought this is correct way described in the documentation https://developers.google.com/chart/interactive/docs/reference#methods_4
However, I got an error message saying setCell is not a function of mydt even though I can call mydt.getValue(). Seems like my datatable is "somehow" read-only? But it is a DataTable not a DataView.. Why is that?