Quantcast
Channel: VBForums - API
Viewing all articles
Browse latest Browse all 168

google chart table API, the select event does not work

$
0
0
Code:

function drawChart3() {

                        // Create the data table.               
                                var json2 = $.ajax({
                                        url: 'statsfull_getdata1.php?type=details', // make this url point to the data file
                                        dataType: 'json',
                                        async: false
                                }).responseText;
                               
                                // Create our data table out of JSON data loaded from server.
                                var data2 = new google.visualization.DataTable(json2);
                                var options2 = {
                                        title: 'Ad Details',
                                                        chartArea:{left:260,top:50},
                                       
                                        width: 1200,
                                        height: 1000
                                };
                                // Instantiate and draw our chart, passing in some options.
                                //do not forget to check ur div ID
                                var table1 = new google.visualization.Table(document.getElementById('chart_main'));
                               
                                 
                                  function selectHandler() {
          var selectedItem = table1.getSelection()[0];
          if (selectedItem) {
            var topping = data.getValue(selectedItem.row, 0);
            alert('The user selected ' + topping);
          }
        }
                                 
                // Add our selection handler.
                google.visualization.events.addListener(table1, 'select', selectHandler);
                                //setInterval(drawChart, 500 );
                                // The select handler. Call the chart's getSelection() method
                table1.draw(data2, options2);
                        }

It all works excpet the selection function. I know the handler and listener work as if i place a simple alert in the function on its own its show ups. It has a problem when i want to select individual items

Viewing all articles
Browse latest Browse all 168

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>