The Problem
Using the Google Chart Tool it is possible to insert HTML values into the field values, however, I am not confident that this is good practice.
The method I have used is as follows:
function drawVisualization() {
// Create and populate the data table.
var data = google.visualization.arrayToDataTable([
['Name', 'Height', 'Smokes','test'],
['Tong Ning mu', 174, true,'<input type="button" value="test" />'],
['Huang Ang fa', 523, false,'<input type="button" value="test" />'],
['Teng nu', 86, true,'<input type="button" value="test" />']
]);
// Create and draw the visualization.
visualization = new google.visualization.Table(document.getElementById('table'));
visualization.draw(data, {
allowHtml: true
});
}
My Questions
- Are there any other better methods of achieving this?
- Are there ways of catching the events from these buttons, whilst also retrieving the id of the row that is receiving the event? In other words, how do I know which button has been clicked and for which row it represents?