I am using nicolaskruchten pivottable, for displaying my data using:
$('#output').pivot([
{country: "USA", city: "Boston"},
{country: "USA", city: "NYC"},
{country: "UK", city: "London"},
],
{
rows: ["country"],
cols: ["city"]
});
Its displaying table properly but now I want to filter my data dynamically in the table.
One of the way is, to filter my available data and redraw pivot table with filter data. I want to know if there is any inbuilt filter method available.
There is an provision for a filter object in the options array of pivot(input [,options]) method but not able to find any example to implement.
If anyone can suggest me how to proceed further ?
You must re-render the table every time you filter. You can pass a filter
attribute which is a function that takes a row as a parameter and returns a boolean. See https://github.com/nicolaskruchten/pivottable/wiki/Parameters#pivotinput-options
I should add that in general, you should file a Github Issue to get help with this library, rather than asking a question on StackOverflow.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With