dc-js / dc.datatables.js

integration of datatables.js with dc.js
Other
12 stars 10 forks source link

filterAll is not a function #5

Open shovondu86 opened 6 years ago

shovondu86 commented 6 years ago

dctable

gordonwoodhull commented 6 years ago

Thanks @shovondu86! It's easy to lose track of all the smaller features. This one is listed in the SO answer which serves as de facto documentation for this topic, which I'll double check when I fix this soon.

Dakdeniz commented 5 years ago

Just adding filterAll function with the same functionality of _table.redraw works.


_table.filterAll = function() {
            _dt.clear()
                .rows.add(_dimension.top(Infinity))
                .draw();
        }; ```
YendorMc commented 3 years ago

HI I added Dakdeniz's code in dc.datatable.js after _table.redraw @ line 117.

I now get get "DataTables warning: table id=DataTables_Table_0 - Cannot reinitialise DataTable. For more information about this error, please see http://datatables.net/tn/3"

Any thoughts as to what else can be the issue?

gordonwoodhull commented 3 years ago

@YendorMc, I can’t think of any reason why this code would work for redraw but not for filterAll.

Just to confirm, do you mean that you get the warning when you click the ‘Reset All’ link? Or some other time?

YendorMc commented 3 years ago

Yes - I do get the warning when I do "Reset All' (it's an alert), or also when I have a preset "View" when I set filters on 'presets' e.g.

function filterit(filters){
    dc.filterAll();

    if (filters == "Region 1"){
        isStateSelect.filter([["AR ","TX ","AL "]])
    }
    else if (filters == "Region 2"){
        isStateSelect.filter([["FL ","GA "]])
    }
    dc.renderAll();
 };

It does work after the popup warning, but would be nice to figure out the annoying popup warning.

On a side note - dc.js is absolutely amazing, Gordon!