I'm hoping this is a problem that's really easy to fix. Having copied all of the necessary code from the Google Visualization site, everything is working with one exception. I have a data table where, if I select a row, the select handler is called - but I am unable to get table.getSelection() to work
I've seen a suggestion that I might need to include getChart(), but that doesn't fix it. In the extract below, I get the first alert message when selecting a row, but not the second, and the code stops running at that point. Can anyone suggest what the problem might be? Many thanks! <html> </body> <head> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript"> google.charts.load('current', {'packages':['table']}); google.charts.setOnLoadCallback(drawTable_1); function drawTable_1() { js_booking = <?php echo json_encode($arr_booking); ?>; js_name = <?php echo json_encode($arr_name); ?>; var data = new google.visualization.DataTable(); data.addColumn('string', 'Booking'); data.addColumn('string', 'Name'); for (i = 0; i < 5; i++) { data.addRows([ [js_booking[i], js_name[i]] ]); } var table = new google.visualization.Table(document.getElementById('table_div_1')); table.draw(data, {showRowNumber: false, sort: 'disable', width: '95%', allowHtml:true}); google.visualization.events.addListener(table, 'select', selectHandler); } function selectHandler(e) { alert('A table row was selected'); var selection = table.getSelection(); alert('Selection identified'); } </script> </head> <body> <div id="table_div_1">Loading...</div> </body> <br> </html> -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/c4f8f091-a8ed-4935-a2ca-596011f9dd83n%40googlegroups.com.
