Removing dataview filter

242 views
Skip to first unread message

DanBo

unread,
Jun 15, 2009, 2:50:35 PM6/15/09
to Google Visualization API
Is there a better/faster method for resetting filter on a dataview so
that you don't have to set the rows back to the full extent of the
orignal array?

// Code Start
var view = new google.visualization.DataView(data);
view.setRows(view.getFilteredRows([{column: 3, minValue: 0}, {column:
4, minValue: 0}]));

var table = new google.visualization.Table(document.getElementById
('table'));
table.draw(view1);

// reset view
view.setRows(1, 47); // <-- Is this the only method?
view.setRows(view.getFilteredRows([{column: 3, minValue: 10}, {column:
4, minValue: 10}]));

var table1 = new google.visualization.Table(document.getElementById
('table1'));
table1.draw(view);

// Code End

Thanks,
Dan

VizWiz

unread,
Jun 18, 2009, 7:28:33 AM6/18/09
to google-visua...@googlegroups.com
Hi,

In the sample code you provided, I don't think you even need to reset. The setRows function works on the underlying datatable and not on the view, so I think you can simply go ahead and call view.setRows(view.getFilteredRows([{column: 3, inValue: 10}, {column: 4, minValue: 10}])) without calling view.setRows(1, 47) first.

I hope this helps.

Cheers,
Yaniv
Reply all
Reply to author
Forward
0 new messages