Thanks Simone, but this hasn't helped me unfortunately. I tried using 
earlier versions, but it didn't fix the problem. I'm still finding that the 
line "var selection = table.getSelection();" stops the javascript running 
for some unknown reason.

On Monday, May 17, 2021 at 9:37:45 AM UTC+1 [email protected] wrote:

> I temporarily solved by loading the previous version of libraries (49).
>
> Il giorno lunedì 17 maggio 2021 alle 10:33:36 UTC+2 Simone Fracassa ha 
> scritto:
>
>> Same problem here, it seemes the getSelection() suddenly stopped to 
>> return the selection. It have always worked, I use it since years. :(
>>
>> Did you managed to solve the issue?
>>
>> Il giorno venerdì 7 maggio 2021 alle 10:33:17 UTC+2 Paul ha scritto:
>>
>>> 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/d9bcf6d0-276b-4b50-81bb-a50bd372f5bbn%40googlegroups.com.

Reply via email to