Cross-reference dataView against dataTable

22 views
Skip to first unread message

Nick

unread,
Feb 2, 2012, 8:04:32 PM2/2/12
to Google Visualization API
Advice much appreciated...

I have a dataTable from which I draw() a Treemap. From this dataTable
I also create a dataView by using getFilteredRows(), using those
filtered rows to draw a Table.

(Reasoning: I have a treemap of countries and cities. If I select
'UK', the treemap shows me UK cities. A listener hears this thanks to
getSelection(), and redraws the table to show only those rows where
parent matches the value 'UK'. In short, the state the treemap and the
table always match).

I see unexpected behaviours with a listener on the Treemap.

table.setSelection(treemap.getSelection());

...causes the wrong table row to be selected.

I'm guessing this is because the rowIndexes from the dataTable and
dataView are different.

Any ideas for a workaround, or something I've missed?

asgallant

unread,
Feb 3, 2012, 9:07:40 AM2/3/12
to google-visua...@googlegroups.com
Use the DataView#getViewRowIndex method to get the view's row from the DataTable's row.  You can then use that to set the selection for the table chart.
Reply all
Reply to author
Forward
0 new messages