Hi here i have a google visualisation code: http://jsbin.com/OJAnaji/15/edit
First I create data (rows and column):
data = google.visualization.arrayToDataTable([
['Name', 'Gender', 'Age', 'Donuts eaten'],
['Michael' , 'Male', 12, 5],
['Elisa', 'Female', 20, 7],
['Robert', 'Male', 7, 3],
['John', 'Male', 54, 2],
['Jessica', 'Female', 22, 6],
['Aaron', 'Male', 3, 1],
['Margareth', 'Female', 42, 8],
['Miranda', 'Female', 33, 6]
]);
Now I need to add new column to this so I write:
data.addColumn('string', 'Kontrole');
So how I have new column and empty cells for that column so I need to fill them and I try this:
for (var y = 0, maxrows = data.getNumberOfRows(); y < maxrows; y++) {
if (data.getValue(y, 4) == '') {
data.setValue(y, 4, '<i class="icon-pencil"></i>');
}
}
but nothing happend, the cell are yet empty. Can someone see where is the problem?
Data from new cells are null
so you have to change
if (data.getValue(y, 4) == '') {
to
if (data.getValue(i, 4) == null) {