I understand the problem is that the filtering changes the table row 
numbers but the associated data retrieved from the data source does not 
change... I attached the code both below and a separate file...


      var dashboard, table, data;
  
  function drawVisualization() {
        
var array = new Array(['ticker','time','bid','open','high','low','volume']);
var ticker, time, bid, open, high, low, volume; 
$.get('php/getdata.php', {input: 'stocklist'}, function(data1){
 $.each(data1, function(index, value){ 
ticker = value.ticker;
time = value.time;
bid = parseFloat(value.bid);
open = parseFloat(value.open);
high = parseFloat(value.high);
low = parseFloat(value.low);
volume = parseFloat(value.volume);
array.push([ticker, time, bid, open, high, low, volume]);
});
        data = google.visualization.arrayToDataTable(array);

        var stringFilter = new google.visualization.ControlWrapper({
          'controlType': 'StringFilter',
          'containerId': 'control1',
          'options': {
            'filterColumnLabel': 'ticker'
          }
        });

        table = new google.visualization.ChartWrapper({
          'chartType': 'Table',
          'containerId': 'chart1',
          'options': {'showRowNumber': false, 'height': '130px', 'width': 
'1000px'}
        });

        dashboard = new 
google.visualization.Dashboard(document.getElementById('dashboard'))
dashboard.bind(stringFilter, table);
dashboard.draw(data);
  
google.visualization.events.addListener(table, 'select', selectHandler);
      }, "json");
  }
  
  function selectHandler() {
var selection = table.getChart().getSelection();
      
  for (var i = 0; i < selection.length; i++) {
var item = selection[i];
if (item.row != null && item.column != null) {
} else if (item.row != null) {
stockID = data.getFormattedValue(item.row, 0);
} else if (item.column != null) {
stockID = data.getFormattedValue(0, item.column);
}
}
if (stockID == '') {
return;
} 
alert(stockID);
    }
      
      google.setOnLoadCallback(drawVisualization);
  

  
  
  

On Monday, 13 August 2012 21:10:08 UTC+1, byteME wrote:
>
> How can I use a getSelection() method to interact with the table in a 
> dashboard..
> Any suggestions is very much appreciated.. thanx.. 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-visualization-api/-/peLvJhLTlZ8J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Attachment: script.js
Description: JavaScript source

Reply via email to