Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter data in DataTables and Redraw all charts #420

Closed
zhx828 opened this issue Nov 18, 2013 · 5 comments
Closed

Filter data in DataTables and Redraw all charts #420

zhx828 opened this issue Nov 18, 2013 · 5 comments
Labels

Comments

@zhx828
Copy link

zhx828 commented Nov 18, 2013

Hi,

Is there anyone know how to filter data in DataTables and Redraw all charts? I combined the dataTable in dc.js and the DataTables(http://datatables.net) by adding $("dataTable").dataTable and dc.dataTable("#dataTable") at same time. Right now, it's able to redraw the data table based on the clicks of each charts. But is there anyway to do the reverse?

Peter

@zhx828 zhx828 closed this as completed Nov 18, 2013
@zhx828 zhx828 reopened this Nov 18, 2013
@jrideout
Copy link
Contributor

@zhx828 You need to set some kind of onClick handler for the table that will filter on the table's dimension and then call dc.redrawAll.

@zhx828
Copy link
Author

zhx828 commented Nov 18, 2013

@jrideout Thank you for your suggestions. I add a 'Refresh Charts' button, and once user clicks it, it will get the current row id into dataTable filter, then do the redrawAll. But question is if I want to add another button 'reset', what should I do to get the original data back except reload current page?

@jrideout
Copy link
Contributor

You can set a filter to null to reset the filter. Or you can call dc.filterAll to reset all filters managed by dc (note if you haven't passed a dimension to a dc chart, this won't reset it).

@zhx828
Copy link
Author

zhx828 commented Nov 19, 2013

@jrideout Thank you. All solved.

@jsmedmar
Copy link

@zhx828 could you provide and example on how you achieve this? would be much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants