If you click on a selected element, it deselects that element, but the
"select" event is still fired. You can test to see if anything is selected
by checking the length of the array returned by
table.getChart().getSelection():
google.visualization.events.addListener(table, 'select', function () {
var sel = table.getChart().getSelection();
if (sel.length > 0) {
var tmpData = table.getDataTable();
var msgArray = ['You have selected:'];
for (var i = 0; i < sel.length; i++) {
msgArray.push(tmpData.getValue(sel[i].row, 0));
}
alert(msgArray.join('\n'));
}
});
On Sunday, January 20, 2013 7:21:02 AM UTC-5, [email protected] wrote:
>
> There's a little bug there that I can't find. The exact code you posted..
>
> When you click on someone I get an alert, if I click on it on the 2nd time
> (on the same line) it's undefined, on the 3rd time (again on the same
> line) it's back again and so on..
>
> Any idea why?
>
> On Friday, January 11, 2013 3:44:27 PM UTC+2, [email protected] wrote:
>>
>> How can I add a select event to the StringFilter? (
>> https://code.google.com/apis/ajax/playground/?type=visualization#stringfilter_control
>> )
>> (like it's done here:
>> https://code.google.com/apis/ajax/playground/?type=visualization#select_eventbut
>> for a simple table).
>>
>
--
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/-/54f7UtG9PDQJ.
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.