I need to add an "invisible" column, which would be triggered on select.
Something like:
var data = new google.visualization.DataTable();
data.addColumn('number', 'Lat'); // Latitude Value
data.addColumn('number', 'Lon'); // Longitude Value
data.addColumn('string', 'Name'); //
data.addColumn('number', 'Consumer Price Index (CPI)', 'Value'); //
data.addColumn('string', 'Invisible'); //
And later on:
google.visualization.events.addListener(geomap, 'select', function() {
var selection = geomap.getSelection()[0];
window.location = selection[4];
});
I'm getting Error message while loading the map:
Incompatible data table: Error: Table contains more columns than expected (Expecting 4 columns)
So it looks like DataTable doesn't accept my Invisible column.
Any idea how to fix that?
Although I haven't found the answer to my question, I've found a workaround which doesn't use DataView (data transform could potentially be slow) and therefore, it is probably much faster.
I've created another array with additional data (variable
hrefs
) in the same order as main DataTable and I do use it in the event as:It works at least in Chrome ;-)