plotly / react-pivottable

React-based drag'n'drop pivot table with Plotly.js charts
https://react-pivottable.js.org/
MIT License
997 stars 254 forks source link

valueFilter option in react-pivottable #61

Open antonio1974 opened 5 years ago

antonio1974 commented 5 years ago

Dear Sirs, I need your help for the valueFilter option. I your documentations there is the following explanation: valueFilter: object whose keys are attribute names and values are objects of attribute value-boolean pairs which denote records to include or exclude from computation and rendering; used to prepopulate the filter menus that appear on double-click. I have the following attribute name:

"Status" with the following attribute values:

Filter Values:

1_Collected 2_Stored 3_Treated 4_Disposed

I insert in my react table the following option:

valueFilter={Object.keys("Status").values([Object.keys("1_Collected").values(false),Object.keys("2_Stored").values(false),Object.keys("3_Treated").values(true),Object.keys("4_Disposed").values(true)])}

and the following options:

valueFilter={Object.keys('Status').values(['1_Collected':false,'2_Stored':false,'3_Treated':true,'4_Disposed':true])}

Both of these don't work. Please may you help me ? Best Regards, Antonio Basiaco

jcrand commented 4 years ago

Assuming you want to hide the 2_Stored value, try this:

valueFilter={"Status": {"2_Stored": true}}

As far as I can tell, it doesn't matter if you say {"2_Stored": true} or {"2_Stored": false}. It's the presence of the "2_Stored" attribute in valueFilter that controls the behavior.