Razzildinho
Razzildinho

Reputation: 2584

Handler for filter clearing in dc.js

I'm using dc.js filterHandler function to check when a chart has a filter applied to it. I'm looking for a similar listener that is called when the filter is removed. I haven't been able to find what I'm looking for in the API docs.

Upvotes: 0

Views: 1110

Answers (2)

Gordon
Gordon

Reputation: 20150

The latest dc.js on master has functions that allow overriding all of the filter behaviors; these can also be used to watch the filter changes on a more granular level.

It looks like the documentation is missing some headlines at the moment, but search in the docs here:

https://github.com/dc-js/dc.js/blob/master/web/docs/api-latest.md

for addFilterHandler, removeFilterHandler, resetFilterHandler.

Since these are handlers and not just listeners, you'll need to wrap the current functionality, like so:

var rfh = chart.resetFilterHandler();
chart.resetFilterHandler(function(filters) {
     console.log('reset!'); // do what you need here
     rfh(filters)
});

Upvotes: 1

Allan Vieira
Allan Vieira

Reputation: 26

Try:

.on("postRedraw", function(chart, filter){function()})

Upvotes: 1

Related Questions